CONTINUE statement (PL/SQL)

The CONTINUE statement terminates the current iteration of a loop within a PL/SQL code block, and moves to the next iteration of the loop.

Invocation

This statement can be embedded within a FOR, LOOP, or WHILE statement, or within a PL/SQL procedure, function, or anonymous block statement.

Authorization

No privileges are required to invoke the CONTINUE statement. However, the authorization ID of the statement must hold the necessary privileges to invoke the SQL statements that are embedded within the FOR, LOOP, or WHILE statement.

Syntax

Read syntax diagramSkip visual syntax diagramCONTINUE

Example

The following example shows a basic LOOP statement with an CONTINUE statement within an anonymous block:
BEGIN
  FOR i IN 1 .. 5 LOOP
    IF i = 3 THEN
       CONTINUE;
    END IF;
    DBMS_OUTPUT.PUT_LINE('Iteration # ' || i);
  END LOOP;
END;

This example generates the following output:

Iteration # 1
Iteration # 2
Iteration # 4
Iteration # 5