next up previous contents
Next: Sequential Control Up: Control Structures Previous: Conditional Control

Iterative Control

PL/SQL provides a LOOP construct for execution of a sequence of statements multiple number of times. There are three forms of LOOP statements: LOOP, FOR-LOOP and WHILE-LOOP.

The basic form of LOOP statement allows unconditional iteration over a number of statements.

To complete the LOOP statement unconditionally or conditionally, the programmer can use EXIT, or EXIT-WHEN statements.

The WHILE-LOOP iterates over the sequence of statements, each time evaluating the condition, executing the statements in case the condition is true and completing execution when the condition is false. FOR-LOOP iterates over the statements for a specified range of integers (Between lower_bound and higher_bound). Codes for both are given below:



Punit Bhargava
Wed Mar 11 18:50:53 PST 1998