SQL>
SQL> -- The IS NULL operator in action.
SQL> SET SERVEROUTPUT ON
SQL> DECLARE
2 test INTEGER;
3 BEGIN
4 --the variable TEST is currently null because
5 -- a value hasn't been assigned to it yet.
6 IF test IS NULL THEN
7 DBMS_OUTPUT.PUT_LINE('The variable TEST is null.');
8 END IF;
9 --Assign a value to TEST and display it.
10 test := 1;
11 DBMS_OUTPUT.PUT_LINE('TEST = ' || TO_CHAR(test));
12 --Test is no longer null because a value has been assigned to it.
13 IF test IS NOT NULL THEN
14 DBMS_OUTPUT.PUT_LINE('The variable TEST is NOT null.');
15 END IF;
16 END;
17 /
The variable TEST is null.
TEST = 1
The variable TEST is NOT null.
PL/SQL procedure successfully completed.
SQL>