Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

XMLAGG comma separated list Advanced

user631262Nov 6 2014 — edited Nov 9 2014

Hi,

I know how to bring up comma separated list of values tied to a particular key, however I wish to show up non-existing rows as well.  Here is my data

We have max value_codes and hence 3 value names in our table.  Key_col is transaction data.

keycol                value_code            value_name
-------               -----------          -----------
100                      'A'                 'ABC'
100                      'P'                 'PQR'
100                      'X'                 'XYZ'
200                      'P'                 'PQR'
300                      'A'                 'ABC'
300                      'P'                 'PQR'
400                      'X'                 'XYZ'
500                      'A'                 'ABC'

I want so generate output in text file in the following format
100        ABC        PQR        XYZ
200                   PQR
300        ABC        PQR
400                              XYZ
500        ABC



Could you please advice if this is possible by writing query?

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 7 2014
Added on Nov 6 2014
12 comments
3,054 views