WHILE Loops
A WHILE
loop runs until a specified condition occurs.
The syntax for a WHILE
loop is as follows:
WHILE condition LOOP
statements
END LOOP;
Example:
SQL> DECLARE
2 v_counter INTEGER;
3 BEGIN
4 v_counter := 0;
5 WHILE v_counter < 6 LOOP
6 v_counter := v_counter + 1;
7 END LOOP;
8 END;
9 /
PL/SQL procedure successfully completed.
SQL>