how to check null value in if condition in pl sql with one example?
i want check the null value through if condition in procedure how to check the which column have the null value??
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Shankar MPosted Nov 27, 2012, 4:43 AM
You can use the NVL function in Oracle SQL to check the existance of NULL values.
Query:
SELECT empno, NVL (LASTNAME, '-')
FROM EMP;
Thanks,
Shankar
Akkiraju IvaturiPosted Aug 11, 2012, 4:33 PM
In PLSQL to check if a value is null, you must use the "IS NULL" syntax.
For example,
If Lvalue contains a null value, the "IF" expression will evaluate to TRUE.
You can also use "IS NULL" in an SQL statement. For example:
This will return all records from the suppliers table where the supplier_name contains a null value.
Pradip PandeyPosted Aug 11, 2012, 6:34 AM
Select ISNULL(CountryName,'No Data') As CountryName, ISNULL(StateName,'No Data') As StateName From EmployeeTable
Sukesh MarlaPosted Aug 11, 2012, 1:59 AM
Select (case when Color=1 then 'RED' when Color='2' Then 'Blue' else 'NO Color' end) as Color From MYTable
You cant use if directly in between any query, For that we have 'case'