PL/SQL (MOSC)

MOSC Banner

NVL command with ' ' (space) as NULL

edited Jun 12, 2013 7:13AM in PL/SQL (MOSC) 8 commentsAnswered ✓
Hi,

In our DB we store character NULL values as a single character blank string ' '.  How does this work with the NVL command?

Example

select NVL (
(SELECT  ' ' from dual)
, 'TEST') from dual;

returns ' '

select NVL (
(SELECT  NULL from dual)
, 'TEST') from dual;

returns 'TEST'

So how can I get 'TEST' to come out when there is a NULL?

Thanks!

-Mike

Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
PL/SQL Release 11.2.0.2.0 - Production

Howdy, Stranger!

Log In

To view full details, sign in to My Oracle Support Community.

Register

Don't have a My Oracle Support Community account? Click here to get started.

Category Leaderboard

Top contributors this month

New to My Oracle Support Community? Visit our Welcome Center

MOSC Help Center