·  PLSQL – Syntax – Variables – BOOLEAN

 

- Info:

  - BOOLEAN is used to store boolean data type.

  - Since SQL does not have an equivalent type, you can't use it inside SQL statements or queries.

  - You cannot insert the values TRUE and FALSE into a database column.

  - You cannot select or fetch column values into a BOOLEAN variable.

  - Neither built-in or custom made functions can take any BOOLEAN parameters.

  - To represent BOOLEAN values in output, you must use IF-THEN or CASE constructs to translate BOOLEAN values

    into some other type, such as 0 or 1, 'Y' or 'N', 'true' or 'false', and so on.

 

- Procedure:

  - Create "PL/SQL Application" Test.sql.

 

    Test.sql      

    DECLARE

      value BOOLEAN;

        

    BEGIN 

      value := TRUE;

      value := FALSE;

      value := NULL;

    

      IF    (value =  TRUE ) THEN DBMS_OUTPUT.PUT_LINE ( 'TRUE'  );

      ELSIF (value =  FALSE) THEN DBMS_OUTPUT.PUT_LINE ( 'FALSE' );

      ELSIF (value IS NULL ) THEN DBMS_OUTPUT.PUT_LINE ( 'NULL'  );

      END IF;

          

    END;