Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SQL Anywhere 12.0.0 » SQL Anywhere Server - SQL Usage » Stored procedures and triggers » Using procedures, triggers, and batches

 

Control statements

There are several 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

See BEGIN statement.

BEGIN [ ATOMIC ]
   Statement-list
END

Conditional execution: IF

See IF statement.

IF condition THEN
   Statement-list
ELSEIF condition THEN
   Statement-list
ELSE
   Statement-list
END IF

Conditional execution: CASE

See CASE statement.

CASE expression
WHEN value THEN
   Statement-list
WHEN value THEN
   Statement-list
ELSE
   Statement-list
END CASE

Repetition: WHILE, LOOP

See LOOP statement.

WHILE condition LOOP
   Statement-list
END LOOP

Repetition: FOR cursor loop

See FOR statement.

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

Break: LEAVE

See LEAVE statement.

LEAVE label

CALL

See CALL statement.

CALL procname( arg, ... )

Using compound statements
Declarations in compound statements
Atomic compound statements