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!

Concat using comma

471326Jul 29 2011 — edited Jul 29 2011
Hi,

We have a table XYZ with columns

A B C D E F, we would like to concat all the values of all columns.

so

select A||', '||B||', '||C||', '||D||', '||E||', '||F
FROM XYZ

It works fine, when all the columns are populated. some times certain columns are not populated. so it looks like

,,123,,456

I would like to get rid of the double comma's are just include only the columns which contain data.

How to achieve it.

Thanks
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 26 2011
Added on Jul 29 2011
11 comments
1,714 views