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!

Concatenating fields having null values

917961Feb 16 2012 — edited Feb 16 2012
Hi All............

I need to concatenate four address fields(ADD1,ADD2,ADD3,ADD4) from a particular table.The output should be like ADD1,ADD2,ADD3,ADD4. I am using the || operator for this query. But if ADD3 is null the output is ADD1,ADD2,,ADD4. How to modify the query so that there is only one comma between ADD2 and ADD4. I am using the following query

select name,add1||','||add2||','||add3||','||add4,count(*) from tablename group by name,add1||','||add2||','||add3||','||add4


Could anyone please resolve this issue now? I am waiting................Thanks in adv
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 15 2012
Added on Feb 16 2012
3 comments
6,013 views