Using Compound Statements - Sybase Adaptive Server IQ 12.4.2 Administration And Performance Manual

Table of Contents

Advertisement

Control statements

Using compound statements

240
Control statement
Compound statements
Conditional execution: IF
Conditional execution: CASE
Repetition: WHILE, LOOP
Repetition: FOR cursor loop
Break: LEAVE
CALL
For complete descriptions of each, see the entries in "SQL Statements" in
Adaptive Server IQ Reference Manual.
A compound statement starts with the keyword
keyword
. The body of a procedure is a compound statement. Compound
END
statements can also be used in batches. Compound statements can be nested,
and combined with other control statements to define execution flow in
procedures or in batches.
A compound statement allows a set of SQL statements to be grouped together
and treated as a unit. SQL statements within a compound statement should be
separated with semicolons.
Syntax
BEGIN [ ATOMIC ]
statement-list
END
IF condition THEN
statement-list
ELSEIF condition THEN
statement-list
ELSE
statement-list
END IF
CASE expression
WHEN value THEN
statement-list
WHEN value THEN
statement-list
ELSE
statement-list
END CASE
WHILE condition LOOP
statement-list
END LOOP
FOR
statement-list
END FOR
LEAVE label
CALL procname( arg, ... )
and ends with the
BEGIN

Advertisement

Table of Contents
loading

Table of Contents