CONTINUE Statement

The CONTINUE statement exits the current iteration of a loop, either conditionally or unconditionally, and transfer control to the next iteration. You can name the loop to be exited.

Syntax

continue_statement ::=

continue_statement
Description of the illustration continue_statement.gif

(boolean_expression ::=)

Keyword and Parameter Descriptions

boolean_expression

If and only if the value of this expression is TRUE, the current iteration of the loop (or the iteration of the loop identified by label_name) is exited immediately.

CONTINUE

An unconditional CONTINUE statement (that is, one without a WHEN clause) exits the current iteration of the loop immediately. Execution resumes with the next iteration of the loop.

label_name

Identifies the loop exit from either the current loop, or any enclosing labeled loop.

Usage Notes

A CONTINUE statement can appear anywhere inside a loop, but not outside a loop.

If you use a CONTINUE statement to exit 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 is closed automatically (in this context, CONTINUE works like GOTO). The cursor is also closed automatically if an exception is raised inside the loop.

Examples

Related Topics