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 |
Why do we need oracle client?
how to use select statement as formal parameter in procedure specification?(someone said that using string) ex:-procedure(a in number,select ename from emp ) i am asking syntax like this?
What is varray?
Why we use bulk collect in oracle?
How to use subqueries with the in operator using oracle?
What is the database name in oracle?
Will you be able to store pictures in the database?explain.
What is open database communication (odbc) in oracle?
primary key is foreign key for the same table?
What are advantages of dateset in datastage?
how can we write trigger in trigger???????? can we write one trigger on two table???
WHEN CURSOR MOVES FROM ONE FORM TO ANOTHER FORM, HOW MANY TRIGGER WILL BE FIRED AND WHAT ARE THEIR SEQUENCE?