IF … THEN … ELSE
Conditional branching
IF (<condition>) THEN <compound_statement> [ELSE <compound_statement>]
Argument | Description |
---|---|
condition |
A logical condition returning |
compound_statement |
A single statement, or statements wrapped in |
The conditional branch statement IF … THEN
is used to branch the execution process in a PSQL module.The condition is always enclosed in parentheses.If the condition returns the value TRUE
, execution branches to the statement or the block of statements after the keyword THEN
.If an ELSE
is present, and the condition returns FALSE
or UNKNOWN
, execution branches to the statement or the block of statements after it.