BOOLEAN and Three-Valued Logic
ExplanationOracle Fusion / EBS · Technical · PL/SQLHigh confidenceGenerated
A BOOLEAN can be TRUE, FALSE or NULL, and any comparison involving NULL yields NULL — not TRUE.
How it works
PL/SQL BOOLEAN is a real type (unlike SQL, which has no boolean column type) and can hold TRUE, FALSE or NULL. Any comparison with NULL (v = NULL, v <> NULL) evaluates to NULL, and IF treats a NULL condition the same as FALSE — so ELSE runs. Use IS NULL / IS NOT NULL to test for NULL, and be careful that NOT NULL is still NULL, not TRUE.
How it works
DECLARE
v_flag BOOLEAN; -- starts as NULL
BEGIN
IF v_flag THEN
DBMS_OUTPUT.PUT_LINE('true branch');
ELSE
DBMS_OUTPUT.PUT_LINE('runs: NULL condition acts like FALSE');
END IF;
IF v_flag IS NULL THEN
DBMS_OUTPUT.PUT_LINE('and this is how you actually test for NULL');
END IF;
END;
/Related questions
GroundingGenerated
Model-generated, grounded against the curated knowledge layer. Check specifics against your instance.