Display Null Query Result With an Alternate Text

Moderator: NorbertKrupa

Post Reply
User avatar
Jbaskin
Intermediate
Intermediate
Posts: 61
Joined: Sat Jan 28, 2012 1:21 pm

Display Null Query Result With an Alternate Text

Post by Jbaskin » Fri Aug 03, 2012 1:19 pm

Hi,

Is there a way that I can display a NULL result from a query as some sort of alternate text in vsql?

Oracle has a feature in SQL*Plus where I type SET NULL = 'N/A' and from that point on all NULLs are replaced with the text 'N/A'.

Example in Oracle:

Code: Select all

SQL> SET NULL = 'N/A'
SQL> SELECT NULL mycol FROM dual;
mycol
-----
N/A

id10t
GURU
GURU
Posts: 732
Joined: Mon Apr 16, 2012 2:44 pm

Re: Display Null Query Result With an Alternate Text

Post by id10t » Fri Aug 03, 2012 2:10 pm

Hi!

vsql has inner help - `\?`

Code: Select all

dbadmin=> \pset null 'N/A'
Null display is "N/A".
dbadmin=> select NULL from DUAL;
 ?column? 
----------
 N/A
(1 row)

User avatar
Jbaskin
Intermediate
Intermediate
Posts: 61
Joined: Sat Jan 28, 2012 1:21 pm

Re: Display Null Query Result With an Alternate Text

Post by Jbaskin » Fri Aug 03, 2012 5:59 pm

Thanks, skwa! That's exactly what I needed!

Post Reply

Return to “vSQL”