13.15 CONTINUE Statement

The CONTINUE statement exits the current iteration of a loop, either conditionally or unconditionally, and transfers control to the next iteration of either the current loop or an enclosing labeled loop.

If a CONTINUE statement exits a cursor FOR loop prematurely (for example, to exit an inner loop and transfer control to the next iteration of an outer loop), the cursor closes (in this context, CONTINUE works like GOTO).

Note:

As of Oracle Database 11g Release 1, CONTINUE is a PL/SQL keyword. If your program invokes a subprogram named CONTINUE, you get a warning.

Restrictions on CONTINUE Statement

  • A CONTINUE statement must be inside a LOOP statement.

  • A CONTINUE statement cannot cross a subprogram or method boundary.

Topics

Semantics

continue_statement

label

Name that identifies either the current loop or an enclosing loop (see "Basic LOOP Statement").

Without label, the CONTINUE statement transfers control to the next iteration of the current loop. With label, the CONTINUE statement transfers control to the next iteration of the loop that label identifies.

WHEN boolean_expression

Without this clause, the CONTINUE statement exits the current iteration of the loop unconditionally. With this clause, the CONTINUE statement exits the current iteration of the loop if and only if the value of boolean_expression is TRUE.

Examples

  • Example 4-13, "CONTINUE Statement in Basic LOOP Statement"

  • Example 4-14, "CONTINUE WHEN Statement in Basic LOOP Statement"

  • Example 4-27, "CONTINUE WHEN Statement in Inner FOR LOOP Statement"