Use and to link two boolean expressions : Boolean Expression « PL SQL « Oracle PL / SQL






Use and to link two 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     -- TRUE and NULL = NULL
  8     IF (a = 2) AND (a <> n) THEN
  9       DBMS_OUTPUT.PUT_LINE('TRUE and NULL = TRUE');
 10     ELSE
 11       DBMS_OUTPUT.PUT_LINE('TRUE and NULL = NULL');
 12     END IF;
 13  END;
 14  /
TRUE and NULL = NULL

PL/SQL procedure successfully completed.

SQL>

           
         
  








Related examples in the same category

1.Effects of nulls on boolean expressions: =
2.Effects of nulls on boolean expressions: >, < (2)
3.Commit or rollback based on success flag