|Oracle® OLAP DML Reference
10g Release 1 (10.1)
Part Number B10339-02
Serves as the criterion for statement execution. While the expression remains
TRUE, statement is repeatedly executed. When the expression becomes
FALSE, the execution of statement ceases, and the program continues with the next line. Ensure that something in the statement (or statements) eventually causes the Boolean expression to become
FALSE; otherwise, the code becomes an endless loop.
One or more statements to be executed while the Boolean expression is
TRUE. You can execute two or more statements by enclosing them within DO ... DOEND brackets. The DO command should follow immediately after the WHILE command.
The WHILE command's main use is as an alternative to the IF...THEN...ELSE command.When you want one or more statements in your program to execute repeatedly for as long as a Boolean expression remains
TRUE, you use WHILE. When you want them to execute only once when a Boolean expression is
TRUE, you use IF.
You can specify a constant for the Boolean expression. When your statement is WHILE TRUE, make sure to include a BREAK, RETURN, or EXIT command between DO ... DOEND so the program can finish the loop.
Example 24-42 Using a WHILE Loop in a Program
In the following program lines, the statements following DO are executed as long as the Boolean expression
TRUE. Within the loop, the code searches for an instance of some condition and, when it finds one, it adds
10, the loop ends. The code in the loop must ensure that
count will, at some time, reach
10. Otherwise, the loop will never end.
WHILE count LT 10 DO ..." (statements) IF .... count = count + 1 DOEND