13.37 GOTO Statement

The GOTO statement transfers control to a labeled block or statement.

If a GOTO statement exits a cursor FOR LOOP statement prematurely, the cursor closes.

Restrictions on GOTO Statement

  • A GOTO statement cannot transfer control into an IF statement, CASE statement, LOOP statement, or sub-block.

  • A GOTO statement cannot transfer control from one IF statement clause to another, or from one CASE statement WHEN clause to another.

  • A GOTO statement cannot transfer control out of a subprogram.

  • A GOTO statement cannot transfer control into an exception handler.

  • A GOTO statement cannot transfer control from an exception handler back into the current block (but it can transfer control from an exception handler into an enclosing block).

Topics

Syntax

Semantics

goto_statement

label

Identifies either a block or a statement (see "plsql_block ::=", "statement ::=", and "label").

If label is not in the current block, then the GOTO statement transfers control to the first enclosing block in which label appears.

Examples

Related Topics

In this chapter:

In other chapters: