Reputation: 189
Consider the table STUDENTS:
---------------------
|Sr.No| Name |
---------------------
| 1 | Jon |
---------------------
| 2 | Rob |
---------------------
| 3 | Bran |
---------------------
Using below query we get:
select listagg(Name, ',') within group (order by Name) from STUDENTS
From this we will get :
Jon,Rob,Bran
How do we get something like
"Jon","Rob","Bran"
Upvotes: 3
Views: 5029
Reputation: 4551
this should do the job
select listagg('"'||Name||'"', ',') within group (order by Name) from STUDENTS;
Upvotes: 15