Contents Index Introduction to batches Using compound statements

ASA SQL User's Guide
  Using Procedures, Triggers, and Batches

Control statements


There are a number of control statements for logical flow and decision making in the body of the procedure or trigger, or in a batch. Available control statements include:

Control statement Syntax
Compound statements

For more information, see BEGIN statement.

BEGIN [ ATOMIC ]
   Statement-list
END
Conditional execution: IF

For more information, see IF statement.

IF condition THEN
   Statement-list
ELSEIF condition THEN
   Statement-list
ELSE
   Statement-list
END IF
Conditional execution: CASE

For more information, see CASE statement.

CASE expression
WHEN value THEN
   Statement-list
WHEN value THEN
   Statement-list
ELSE
   Statement-list
END CASE
Repetition: WHILE, LOOP

For more information, see LOOP statement.

WHILE condition LOOP
   Statement-list
END LOOP
Repetition: FOR cursor loop

For more information, see FOR statement.

FOR loop-name
   AS cursor-name
   CURSOR FOR select statement
DO
   Statement-list
END FOR
Break: LEAVE

For more information, see LEAVE statement.

LEAVE label
CALL

For more information, see CALL statement.

CALL procname( arg, ... )

For more information about each statement, see the entries in SQL Statements


Using compound statements
Declarations in compound statements
Atomic compound statements

Contents Index Introduction to batches Using compound statements