WHILE

The WHILE statement is used in SQL Script to execute certain statements as long as specific conditions are met.

Syntax

[<label>:] WHILE <conditionalExpression> DO
<statements>
END WHILE [<label>

Remarks

The <label> is an optional identifier to name the block.
The WHILE statement is for use with the LEAVE and ITERATE statements. See LEAVE and ITERATE.
If a beginning label is present, the end label is not required. If no beginning label is present, it is illegal to have an end label. If both the beginning and end labels are present, both must have the same identifier.
The <statements> area can have zero or more statements.