Monday, December 22, 2014

Rows to String

Just a note about a powerful way to convert a column of values in a query into a coma separated list in a text string:

select 'LISTAGG' fx,
       length(listagg(table_name, ',')
             within group (order by table_name) ),
       listagg(table_name, ',') within group (order by table_name)
  from user_tables;