The BOOLEAN type stores the results of logical operations.
The valid value of the BOOLEAN type is TRUE, FALSE, or NULL. NULL indicates that the result is unknown.
Syntax:
variable_name BOOLEAN
BOOLEAN is not a valid SQL type, so the following limits apply when you use it:
You cannot assign a BOOLEAN value to a table column.
You cannot assign a data in a table to a BOOLEAN variable.
You cannot use a BOOLEAN variable in any SQL function.
You cannot use a BOOLEAN expression in an SQL statement unless you pass it in through a PL function.
Example:
obclient> CREATE OR REPLACE PROCEDURE output_bool (b BOOLEAN)
AUTHID DEFINER IS
BEGIN
DBMS_OUTPUT.PUT_LINE (
CASE
WHEN b IS NULL THEN 'NA'
WHEN b THEN 'Y'
WHEN NOT b THEN 'N'
END
);
END;
/
obclient> BEGIN
output_bool(TRUE);
output_bool(FALSE);
output_bool(NULL);
END;
/
Query OK, 0 rows affected
Y
N
N/A