Iterative Statements : While Loop
While Loop
A WHILE LOOP is used when a set of statements has to be executed as long as a condition is true. The condition is evaluated at the beginning of each iteration. The iteration continues until the condition becomes false.
The General Syntax to write a WHILE LOOP is:
WHILE <condition>
LOOP statements;
END LOOP;
Important steps to follow when executing a while loop:
- Initialise a variable before the loop body.
- Increment the variable in the loop.
- EXIT WHEN statement and EXIT statements can be used in while loops but it's not done oftenly.
page revision: 1, last edited: 13 Jan 2010 12:27