Null Value

How to handle Null value in WHERE Condition?

Questions by anjinunna   answers by anjinunna

Showing Answers 1 - 12 of 12 Answers

Dbanumirza

  • Dec 4th, 2009
 

We can use nvl function in WHERE clause to handle null values.

Syntax: SELECT col_name FROM table_name WHERE nvl(col_name,val)=expr;

here val is what ever value you want to replace, when col_name returns null value. If the column type is varchar2 or date  then val should be in single quotes.

  Was this answer useful?  Yes

You should use "IS NULL" or "IS NOT NULL" in the where clause.

For example :

select DEPT_NAME from DEPT where DEPT_CD IS NOT NULL;

The above query returns all those department names from the table "DEPT" where the column "DEPT_CD" is not null.

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions