Effects of nulls on boolean expressions: = : Boolean Expression « PL SQL « Oracle PL / SQL






Effects of nulls on boolean expressions: =

 

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  BEGIN
  5     -- Assign a value to the variable A, but leave N null.
  6     a := 2;
  7     -- Note that the test for A=N fails.
  8     IF a = n THEN
  9       DBMS_OUTPUT.PUT_LINE('a = n is true');
 10     ELSE
 11       DBMS_OUTPUT.PUT_LINE('a = n is not true');
 12     END IF;
 13  END;
 14  /
a = n is not true

PL/SQL procedure successfully completed.

SQL>
           
         
  








Related examples in the same category

1.Effects of nulls on boolean expressions: >, < (2)
2.Use and to link two boolean expressions
3.Commit or rollback based on success flag