Thursday 1 October 2015

Oracle 11.2 SQL 'listagg' option

Nice learning. Very good option 'listagg' in Oracle which will convert multiple rows into a single line in 'Single column Table'.

Following query will give list ownerwise list of tables.

SELECT TABLE_NAME,
       listagg (OWNER, ',') WITHIN GROUP (ORDER BY OWNER)
        OWNER
FROM DBA_TABLES
GROUP BY TABLE_NAME;

No comments:

Post a Comment