IF

Use the IF statement to create a logical branch within an SPL routine.

Syntax

(1)
Notes:

Usage

The database server processes the IF statement by the following steps:
  1. If the condition that follows the IF keyword is true, any statements that follow the first THEN keyword of the IF statement execute, and the IF statement terminates.
  2. If the result of the initial IF condition is false, but an ELIF clause exists, the database server evaluates the condition that follows the ELIF keyword.
  3. If the result of the ELIF condition is true, any statements that follow the THEN keyword of the ELIF clause execute, and the IF statement terminates.
  4. If the result of the condition in the first ELIF clause is also false, but one or more additional ELIF clauses exist, the database server evaluates the condition in the next ELIF clause, and proceeds as in the previous step if it is true. If it is false, the database server evaluates the condition in successive ELIF clauses, until it finds a condition that is true, in which case it executes the statement list that follows the THEN keyword of that ELIF clause, and the IF statement terminates.
  5. If no condition in the IF statement is true, but the ELSE clause exists, statements that follow the ELSE keyword execute, and the IF statement terminates.
  6. If none of the conditions in the IF statement are true, and no ELSE clause exists, the IF statement terminates without executing any statement list.