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!

using nvl for a column with char datat type...

venkatraman.LJul 13 2010 — edited Jul 13 2010
The Entity table has 4 records with 'X' account status and 42 records with account_status as null.

select * from entity where nvl(account_status,'X') = 'X'

when I execute the above query, all the 46 records needs to be fetched but only 42 records with null account status alone is fetched.

Also when I run the below query,

select * from entity where nvl(account_status,'T') ='X'. No row is fethced.

The column account_status is char data type.

When I use same type of query with a column of number datatype it works correctly.

Will nvl work differently for a char data type column? Could somebody help me out on this? I'm not sure if I'm wrong anywhere.

vesrion of Oracle I'm using here is Oracle 10g.
This post has been answered by 534103 on Jul 13 2010
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 10 2010
Added on Jul 13 2010
4 comments
2,940 views