SQL>
SQL> -- Effects of nulls on boolean expressions.
SQL> SET SERVEROUTPUT ON
SQL>
SQL> DECLARE
2 a INTEGER;
3 n INTEGER; -- be our null value.
4 b BOOLEAN;
5 BEGIN
6 -- Assign a value to the variable A, but leave N null.
7 a := 2;
8 b := (a <> n);
9
10 IF b THEN
11 DBMS_OUTPUT.PUT_LINE('a <> n is TRUE');
12 ELSIF NOT b THEN
13 DBMS_OUTPUT.PUT_LINE('a <> n is FALSE');
14 ELSE
15 DBMS_OUTPUT.PUT_LINE('a <> n is NULL');
16 END IF;
17 END;
18 /
a <> n is NULL
PL/SQL procedure successfully completed.
SQL>
|