Conditions in an IF Statement

Just as in the WHILE statement, if any expression in the condition evaluates to NULL, then the condition cannot be true, unless you are explicitly testing for NULL using the IS NULL operator. The following rules summarize NULL values in conditions:
  1. If the expression x evaluates to NULL, then x is not true by definition. Furthermore, NOT (x) is also not true .
  2. IS NULL is the only operator that can return true for x. That is, x IS NULL is true, and x IS NOT NULL is not true.

If an expression in the condition has an UNKNOWN value from an uninitialized SPL variable, the statement terminates and raises an exception.

You can specify a trigger-type Boolean operator (DELETING, INSERTING, SELECTING, or UPDATING) as a condition in an IF statement only within a trigger routine.

IF Statement List

Read syntax diagramSkip visual syntax diagram
IF Statement List

                                (1)          
|--+-BEGIN--| Statement Block |------END-+----------------------|
   |                              (2)    |   
   +-| Subset of SPL Statements |--------+   
   |                              (3)    |   
   '-| Subset of SQL Statements |------;-'   

Notes:
  1. See Statement Block
  2. See Subset of SPL Statements Allowed in the IF Statement List
  3. See SQL Statements Not Valid in an IF Statement

Copyright© 2021 HCL Technologies Limited