The GOTO statement permits a jump to a labeled statement within
a procedure.
Scope |
![](../../img/s.gif) |
Procedures only
SQL Syntax |
![](../../img/s.gif) |
{GOTO
GO TO}{Label
Integer} |
Parameters |
![](../../img/s.gif) |
- Label
specifies an identifier label for branching within
the procedure.
- Integer
specifies an integer label for branching within
the procedure.
Description |
![](../../img/s.gif) |
The label or integer referred to in a GOTO statement is followed by a colon and a statement.
Authorization |
![](../../img/s.gif) |
Anyone can use the GOTO statement.
Example |
![](../../img/s.gif) |
CREATE PROCEDURE Process10 AS
BEGIN
INSERT INTO SmallOrders VALUES ('Widget', 10);
IF ::sqlcode <> 0 THEN
GOTO Errors;
ENDIF;
RETURN 0;
Errors: PRINT 'There were errors.';
RETURN 1;
END;
|