13.35 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
GOTOstatement cannot transfer control into anIFstatement,CASEstatement,LOOPstatement, or sub-block. -
A
GOTOstatement cannot transfer control from oneIFstatement clause to another, or from oneCASEstatementWHENclause to another. -
A
GOTOstatement cannot transfer control out of a subprogram. -
A
GOTOstatement cannot transfer control into an exception handler. -
A
GOTOstatement 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
goto_statement ::=
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
-
Example 4-29, "GOTO Statement"
-
Example 4-32, "GOTO Statement Transfers Control to Enclosing Block"
-
Example 4-33, "GOTO Statement Cannot Transfer Control into IF Statement"
