Reputation: 1
My input is in the below form:
select a.ab from tableone a ;
Result :
aa
bb
cc
Desired output:
('aa','bb','cc')
Upvotes: 0
Views: 18
Reputation: 142720
Use LISTAGG
function.
Table contents:
SQL> select ab from tableone;
AB
--
aa
bb
cc
Result you need:
SQL> select '(' || listagg(chr(39) || ab || chr(39), ',') within group (order by ab) || ')' result from tableone;
RESULT
--------------------------------------------------------------------------------
('aa','bb','cc')
SQL>
Upvotes: 1