|
|
LEAVE
Leaves a labeled
procedural-sql-statement.Usage
Description
The
LEAVEstatement can be used to terminate the execution of aprocedural-sql-statement. For a list of procedural SQL statements, see Procedural SQL Statements.The
labelis the beginning label of aprocedural-sql-statementwithin the scope containing theLEAVEstatement.Restrictions
A
procedural-sql-statementmust have a beginning label ifLEAVEis to be used to terminate its execution.Notes
All intervening compound statements between the statement identified by the label and the leave statement will be left. The following actions occur before execution of the compound statements is terminated, after the
LEAVEstatement is executed:
- Every open cursor declared in the compound statements is closed.
- All variables, cursors and handlers declared in the compound statements are destroyed.
- All condition names declared in the compound statements cease to be defined.
If the
LEAVEstatement is executed within a compound statement forming the body of a procedure, execution of the procedure will be terminated.Example
CREATE PROCEDURE procedure_name(INOUT Y INTEGER) CONTAINS SQL S0: BEGIN ... S1: BEGIN IF Y < 0 THEN SET Y = 0; LEAVE S0; END IF; ... END S1; ... END S0;Standard Compliance
|
Mimer Information Technology AB Voice: +46 18 780 92 00 Fax: +46 18 780 92 40 info@mimer.se |
|
|