Control statements may only be specified in routines. They control execution of a routine,e.g. by means of loops or conditions. They can become extensive and in turn contain sequences of SQL statements themselves.
SQL statement | Function | see |
COMPOUND | Executes SQL statements in a common context | |
CALL | Call a procedure | |
CASE | Executes SQL statements conditionally | |
FOR | Executes SQL statements in a loop | |
IF | Executes SQL statements conditionally | |
ITERATE | Switches to the next loop pass | |
LEAVE | Terminates loop or COMPOUND statement | |
LOOP | Executes SQL statements in a loop | |
REPEAT | Executes SQL statements in a loop | |
RETURN 1 | Supplies the return value of a User Defined Function (UDF) | "RETURN - Supply the return value of a User Defined Function (UDF)" |
SET | Assigns a value | |
WHILE | Executes SQL statements in a loop |
Table 28: Control and diagnostic statements of routines
1For UDFs only
In SESAM/SQL V9.0 and higher, nested calls of routines are permitted. The CALL statement is therefore one of the SQL statements permitted in a routine.