Use the WHILE statement to establish a loop with variable end conditions.



Element Description Restrictions Syntax
label Name of the loop label for this loop Must be unique among labels in this SPL routine Identifier


The condition is evaluated before the statement block first runs and before each subsequent iteration. Iterations® continue as long as the condition remains true. The loop terminates when the condition evaluates to not true.

If any expression within the condition evaluates to NULL, the condition becomes not true unless you are explicitly testing for NULL with the IS NULL operator.

If an expression within the condition has an UNKNOWN value because it references uninitialized SPL variables, an immediate error results. In this case, the loop terminates, raising an exception.