Oracle 11g: The CONTINUE statement
Finally Oracle 11g added the CONTINUE statement
to PL/SQL.
It means go to the end of the loop and loop again. The following shows
how the control moves to the end of the loop when the total becomes 10.
BEGIN
FOR my_total IN 1..1000 LOOP
CONTINUE WHEN my_total = 10;
DBMS_OUTPUT.PUT_LINE ("my_total =" || my_total);
END LOOP;
END;
** Notice that only when my_total reached to 10,
the loop condition stops.
Another variation of the CONTINUE is using a Loop Name.
BEGIN
FOR my_total IN 1..1000 LOOP
CONTINUE Go2Continue WHEN my_total = 10;
DBMS_OUTPUT.PUT_LINE ("my_total = " || my_total);
<<Go2Continue>>
END LOOP;
END;
You should remember that you only can reference to inside a loop. If you
go to outside a loop, you will get a compiler error.
Good Luck!
|