The GOTO statement can unconditionally branches to a statement label.
Statement labels are identifiers of a block of code.
Statement labels can be accessed directly by the GOTO statement.
The label is surrounded by double brackets << >>.
The label must not have a semicolon after the label name.
The Syntax for the GOTO Statement
label_name is the matching label_name that must be contained within the same PL/SQL block of code.
Scoping Rules for the GOTO Statement
The GOTO destination must be in the same block, at the same level as or higher than the GOTO statement itself.
The label must be within the same scope as the GOTO statement itself.
Conditions that would cause Oracle to not compile the PL/SQL code include
- Jumping into a lower level block
- Jumping into a loop
- Jumping into an IF statement
- Using GOTO to jump from one part of an IF statement to another
- Jumping from an exception handler back to a current block of PL/SQL code
Sams Teach Yourself PL/SQL in 21 Days (2nd Edition)
# Paperback: 720 pages
# Publisher: Sams; 2nd edition (December 23, 1999)
# Language: English
# ISBN-10: 0672317982
# ISBN-13: 978-0672317989