ALLBASE/SQL Reference Manual (36216-90216)
Chapter 11 435
SQL Statements E - R
GOTO
GOTO
The GOTO statement permits a jump to a labeled statement within a procedure.
Scope
Procedures only
SQL Syntax
{GOTO
GO TO}{
Label
Integer
}
Parameters
Label
specifies an identifier label for branching within the procedure.
Integer
specifies an integer label for branching within the procedure.
Description
The label or integer referred to in a GOTO statement is followed by a colon and a statement.
Authorization
Anyone can use the GOTO statement.
Example
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;