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!

Printing NULL value in result

user10508700Jul 19 2013 — edited Jul 19 2013

I'm running a SELECT statement on the form below:

SELECT col1 ||'|'|| col2 ||'|'|| col3

FROM table;

This gives me the following outprint, which is what I need

col1|col2|col3

varchar2|number|varchar2

The problem is when col2 is returning a NULL value, then I get this:

varchar2||varchar2

When what i want is this:

varchar2|(null)|varchar2

Is there any way to get my query results to print NULL value as (null)?

I've tried the NVL function, NVL(col2, 'null') but this won't work since there's a mismatch on datatypes. I can get the NULL value printed by not concatenating the columns and save the results as csv, but that does not give me the formatting I want.

This post has been answered by Purvesh K on Jul 19 2013
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 16 2013
Added on Jul 19 2013
3 comments
2,607 views