78
PL/SQL Continue Statement
The continue statement is used to exit the loop from the reminder if its body either conditionally or unconditionally and forces the next iteration of the loop to take place, skipping any codes in between.
The continue statement is not a keyword in Oracle 10g. It is a new feature encorporated in oracle 11g.
For example: If a continue statement exits a cursor FOR LOOP prematurely then it exits an inner loop and transfer control to the next iteration of an outer loop, the cursor closes (in this context, CONTINUE works like GOTO).
Syntax:
Example of PL/SQL continue statement
Let’s take an example of PL/SQL continue statement.
After the execution of above code, you will get the following result:
Inside loop: x = 0 Inside loop: x = 1 Inside loop: x = 2 Inside loop, after CONTINUE: x = 3 Inside loop: x = 3 Inside loop, after CONTINUE: x = 4 Inside loop: x = 4 Inside loop, after CONTINUE: x = 5 After loop: x = 5
Note: The continue statement is not supported in Oracle 10g. Oracle 11g supports this as a new feature.
Next TopicPL/SQL GOTO