how can get like this result
table A
col1 col2
--- -----
a A
b B
C C
.. ..
.. ...
.. ...
wants result like for a single column
col1
------
a,b,c,........n of data
and
another is
col1
-------
A B C D ........
a b b d ........
Answers were Sorted based on User's Feedback
Answer / ajit
select wm_concat(col1) col1
from t1;
select wm_concat(col2)||chr(10)||
wm_concat(col1) col1
from t1;
| Is This Answer Correct ? | 1 Yes | 0 No |
Answer / suman rana
If you are using Oracle 11g Release 1 and above version,
following queries will work.
SELECT listagg (b, ',') WITHIN GROUP (ORDER BY 1) hh
FROM (SELECT 'A' a, 'a' b FROM DUAL
UNION
SELECT 'B', 'b' FROM DUAL
UNION
SELECT 'C', 'c' FROM DUAL);
WITH qry AS
(SELECT 'A' a, 'a' b FROM DUAL
UNION
SELECT 'B', 'b' FROM DUAL
UNION
SELECT 'C', 'c' FROM DUAL)
SELECT listagg (a, ' ') WITHIN GROUP (ORDER BY 1) FROM qry
UNION ALL
SELECT listagg (b, ' ') WITHIN GROUP (ORDER BY 1) FROM qry;
| Is This Answer Correct ? | 1 Yes | 1 No |
What are the values that can be specified for OPTIMIZER MODE Parameter ?
Please HELP me its urgent? If i want to EXPORT data from SQL server to ORACLE 11g then how can I replicate data from SQL to ORACLE?
What is a trace file and how is it created in oracle?
How many objectname will be created for a single table drop function? Why 'flashback' query giving error "ORA-38312: original name is used by an existing object" while getting the table?
what is the use of triggers in Java program? I mean where do we use triggers in Java programming?
What is pragma restrict_reference in oracle 9i?When we use this?Give me one realtime scenario?
I just want to maintain data like an employee can belongs to 3 or more departments . We can resolve this by using composite key but it avoids normalization rules. So Can anyone tell me how can I maintain data.
What is archive log in Oracle?
what is unique key?
14 Answers Amazon, Cap Gemini, Infosys, Wipro,
Please explan Why static query is more faster than dynamic query ?
diff between DELETE and TRUNCATE?.
14 Answers HCL, Yalamanchili Software,
what is the syntax of INSERT command?