Skip to Main Content

SQL Developer

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!

String Concatination

2693537Feb 14 2017 — edited Feb 14 2017

Hi All,

Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production.

I need to concat a addresses files to one address filed with the delimiter of comma.

If any one of the address filed is null, i want handle the comma.

sample data:

select id,

address1||','||address2||','||address3||','||address4 as Address

from test11;

Output:

ID                     Address

1                     Ram Ngar,Anna Nagar,T Nagar,Rose Nagar

2                     KK Nagar, ,MMD Nagar,

3                        ,KKN Street, ,GST Road

4                     , , ,BNN Road

5                     , , , ,

Required output:

ID                     Address

1                     Ram Ngar,Anna Nagar,T Nagar,Rose Nagar

2                     KK Nagar,MMD Nagar

3                     KKN Street,GST Road

4                     BNN Road

5                    

Regards,

Guna

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 14 2017
Added on Feb 14 2017
3 comments
478 views