Conditional jumps
Available in
PSQL
Syntax
The conditional jump statement IF … THEN
is used to branch the execution process in a PSQL module. The condition is always enclosed in parentheses. If it returns the value TRUE, execution branches to the statement or the block of statements after the keyword . If an ELSE
is present and the condition returns FALSE or UNKNOWN, execution branches to the statement or the block of statements after it.
PSQL does not provide multi-branch jumps, such as CASE
or SWITCH
. Nevertheless, the CASE
search statement from DSQL is available in PSQL and is able to satisfy at least some use cases in the manner of a switch:
Example in PSQL
Example
An example using the statement. Assume that the FIRST
, LINE2
and LAST
variables were declared earlier.
See also