Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

Control statements in routines

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

"COMPOUND - Execute SQL statements in a common context"

CALL

Call a procedure

"CALL - Execute procedure"

CASE

Executes SQL statements conditionally

"CASE - Execute SQL statements conditionally"

FOR

Executes SQL statements in a loop

"FOR - Execute SQL statements in a loop"

IF

Executes SQL statements conditionally

"IF - Execute SQL statements conditionally"

ITERATE

Switches to the next loop pass

"ITERATE - Switch to the next loop pass"

LEAVE

Terminates loop or COMPOUND statement

"LEAVE - Terminate a loop or COMPOUND statement"

LOOP

Executes SQL statements in a loop

"LOOP - Execute SQL statements in a loop"

REPEAT

Executes SQL statements in a loop

"REPEAT - Execute 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

"SET - Assign value"

WHILE

Executes SQL statements in a loop

"WHILE - Execute 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.