WHILE ... DO |
Top Previous Next |
Use for conditional looping.
Syntax <while_do_loop> ::= WHILE (<condition>) DO <compound_statement>
<compound_statement> ::= {<block> | <statement>}
A WHILE statement implements a loop, the <compound_statement> will be executed as long as the <condition> evaluates to TRUE. This means it's possible the statements in the loop aren't executed at all.
The loop will end when <condition> evaluates to FALSE or UNKNOWN.
The loop can be broken without evaluating the condition with a LEAVE statement or exited with a EXIT or RETURN statement. The next iteration can be forced using a CONTINUE statement.
See Also
Example EXECUTE UDSBLOCK AS BEGIN I = 1; WHILE (i < 10) DO BEGIN i = i + 1; IF (Math.Mod(i, 2) = 0) /* check for even numbers, skip the loop if even */ THEN CONTINUE; ELSE BEGIN /* do stuff */ END END END |