Oracle® Database PL/SQL Language Reference 11g Release 2 (11.2) Part Number E10472-02 |
|
|
View PDF |
The GOTO
statement transfers control to a labeled block or statement.
Topics:
Syntax
goto_statement ::=
Semantics
label
Identifies either a block or a statement (see the syntax diagrams plsql_block ::= and statement ::= and the description of label).
If the GOTO
statement cannot find label
in the current block, it transfers control to the first enclosing block in which label
appears.
Usage
If a GOTO
statement exits a cursor FOR
loop prematurely, the cursor closes.
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 from an exception handler back into the current block. However, a GOTO
statement can transfer control from an exception handler into an enclosing block.
Examples
Example 4-31, "GOTO Statement Transfers Control to Enclosing Block"
Example 4-32, "GOTO Statement Cannot Transfer Control into IF Statement"
Related Topics
In this chapter:
In other chapters: