Posted on Sunday, 6th September 2009 by captainmi2
->
How to use null in PL\SQL
below are example:
declare
var_a varchar2(10) := null;
begin
if var_a = null then
dbms_output.put_line('empty');
else
dbms_output.put_line(' not empty');
end if;
end;
the above statement will output
“not empty” because the null is not use accordingly.
if the statement were use as below
declare
var_a varchar2(10) := null;
begin
if var_a is null then
dbms_output.put_line('empty');
else
dbms_output.put_line('not empty');
end if;
end;
this will return “empty”
This 2nd statement is the correct way to use the null in the PL\SQL script
Using the NULL in the Oralce SQL statement
Supposed you have 4 records in the employee table. One record does not have salary value.
to get the records from employee without salary value, NULL must be use in where clause
select * from employee
where salary is null
Tags: Oracle PL\SQL Null
Posted in Basic, Oracle | Comments (0)



