Control statement
|
Description
|
---|---|
SET variable = expression
|
Assigns a value to a variable. The value can be either a literal value (for example, 10 or 'text') or another variable. Parameters are considered as normal variables.
|
variable ::= expression
|
Alternate syntax for assigning values to variables.
|
WHILE
expr LOOP statement-list END LOOP |
Loops while expression is true.
|
LEAVE
|
Leaves the innermost while loop and continues executing the procedure from the next statement after the keyword end loop.
|
IF
expr THEN statement-list1 ELSE statement-list2 END IF |
Executes statements-list1 if expression expr is true; otherwise, executes statement-list2.
|
IF
expr1 THEN statement-list1 ELSEIF expr2 THEN statement-list2 END IF |
If expr1 is true, executes statement-list1. If expr2 is true, executes statement-list2. The statement can optionally contain multiple elseif statements and also an else statement.
|
RETURN
|
Returns the current values of output parameters and exits the procedure. If a procedure has a return row statement, return behaves like return norow.
|
RETURN SQLERROR OF cursor-name
|
Returns the sqlerror associated with the cursor and exits the procedure.
|
RETURN ROW
|
Returns the current values of output parameters and continues execution of the procedure. Return row does not exit the procedure and return control to the caller.
|
RETURN NOROW
|
Returns the end of the set and exits the procedure.
|