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!

null value nvl function problem

875255Sep 18 2012 — edited Sep 18 2012
hi,

i have a table named "SAL" with two columns "NAME" and "SALARY".
"NAME" column got varchar2 data type and "SALARY" column got number data type.

Here's the command

select nvl(salary,0) from sal where name='steve';

now if the table got an entry where name is steve and the salary is null then it will return 0 due to nvl function.

but if there is no entry with name steve the result will be null.

I want if even there is no entry named steve in the table the result must be 0 instead of null. what will be the command?
This post has been answered by jeneesh on Sep 18 2012
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 16 2012
Added on Sep 18 2012
7 comments
1,724 views