the built in function is LIST_AGG but it's only available in 11gR2 and higher.
For 10g you can build your own aggregate like stragg or use collect keyword and a function to split the table into a string or you can use aggregation through xml which doesn't require the creation of any user types or functions
Main Topics
Browse All Topics





by: k_murli_krishnaPosted on 2009-11-08 at 08:58:07ID: 25770990
There is a built-in function available which will do the job for you to comma separate since you already know the basic join query. I cannot recollect name of this function now.
The other way is to do it in a procedure using a cursor and in the loop of cursor to get the comma separation.
This third way is to pass SITE_NAME column from Research Sites table to a function in which you will initiate 2 strings to '' and third to current SITE_NAME and swap values and in last step take sub-string to cut off comma in the last. This function you will make it part of the query just like the built-in function in first method.
As far as possible use built-in function i.e. do not reinvent the wheel since BIF are better performing since already optimized.