solidDB Help : solidDB reference : ODBC: Minimum SQL grammar requirements : SQL statements : Control statements (logical condition)
  
Control statements (logical condition)
This topic provides a summary of control statements that are available in solidDB database procedures.
For a more detailed description of these control statements, see Using control statements.
 
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.
boolean_expr
A boolean expression which evaluates to "true" or "false". The expression can include comparison operators, such as =, >, and <) and logical operators and, or, and not.
statement_list
A valid procedure statement that executes as a result of a boolean expression.
while
  boolean_expr
loop
  statement_list
end loop
This loops while the expression is true. For examples of valid parentheses use in WHILE loops, see Using control statements.
leave
Leaves the innermost while loop and continues executing the procedure from the next statement after the keyword end loop.
if
  boolean_expr
then
  statement_list1
else
  statement_list2
end if
Executes statement_list1 if boolean_expr is true; otherwise, executes statement_list2. For examples of valid parentheses use in IF statements, see Using control statements.
if"
  boolean_exprl
then
  statement_listl
elseif
  boolean_expr2
then
  statement_list2
end if
If boolean_expr1 is true, executes statement_list1. If boolean_expr2 is true, executes statement_list2. The statement can optionally contain multiple elseif statements and also an else statement. For examples of valid parentheses use in IF statement, see Using control statements.
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.
Go up to
SQL statements