Suppose I have a BOOLEAN
variable within a PL/SQL block in an Oracle Form:
DECLARE
is_viewable BOOLEAN;
BEGIN
is_viewable := ...;
IF NOT is_viewable THEN
raise_my_error(); // pseudo-code
END IF;
END;
After stepping through this code several times with a debugger, I have determined that raise_my_error()
never gets called. To clarify:
raise_my_error()
does not get called ifis_viewable = TRUE
raise_my_error()
does not get called ifis_viewable = FALSE
Initial tests suggest that this behavior is limited to PL/SQL code run within Oracle Forms and not PL/SQL code run directly within the database (although I could be wrong).
I can get around this by explicitly comparing is_viewable
to FALSE
:
IF is_viewable = FALSE THEN
raise_my_error();
END IF;
I am still curious why NOT is_viewable
never evaluates to TRUE
.
Update: It appears that my debugger wasn't showing correct values and that this question is no longer valid. Sorry about that confusion.
NOT is_viewable
would always evaluate toFALSE
(regardless of the value ofis_viewable
) whereasis_viewable = FALSE
would evaluate to eitherTRUE
orFALSE
, depending on the value ofis_viewable
. Because the problem stopped occurring, I can't verify any answers. :( – Huldahuldah