EasyManua.ls Logo

Sybase Adaptive Server Anywhere - LEAVE Statement

Sybase Adaptive Server Anywhere
1182 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
LEAVE statement
558
LEAVE statement
Use this statement to leave a compound statement or loop.
LEAVE
statement-label
None.
None.
"LOOP statement" on page 567
"FOR statement" on page 528
"BEGIN statement" on page 404
"Using Procedures, Triggers, and Batches" on page 435 of the book ASA
User’s Guide
The LEAVE statement is a control statement that allows you to leave a
labeled compound statement or a labeled loop. Execution resumes at the first
statement after the compound statement or loop.
The compound statement that is the body of a procedure or trigger has an
implicit label that is the same as the name of the procedure or trigger.
SQL/92 Persistent Stored Module feature.
Sybase Not supported in Adaptive Server Enterprise. The BREAK
statement provides a similar feature for Transact-SQL compatible
procedures.
The following fragment shows how the LEAVE statement is used to
leave a loop.
SET i = 1;
lbl:
LOOP
INSERT
INTO Counters ( number )
VALUES ( i );
IF i >= 10 THEN
LEAVE lbl;
END IF;
SET i = i + 1
END LOOP lbl
The following example fragment uses LEAVE in a nested loop.
outer_loop:
LOOP
SET i = 1;
inner_loop:
LOOP
Function
Syntax
Permissions
Side effects
See also
Description
Standards and
compatibility
Examples

Table of Contents

Related product manuals