SELECT Statement

The SELECT statement evaluates a condition and then selects a branch according to the result from multiple branches.

A SELECT statement can include one or more WHEN statements and either zero or one OTHERWISE statements. A SELECT statement must be paired with an END statement.

figure syntax select
SELECT Statement
Component Description

SELECT (expression)

Expression to be evaluated and saved.

WHEN (expression) unit

There can be one or more expressions. To specify multiple expressions, separate each expression with '&' or '|' as delimiter. Each expression is evaluated and compared with the expression value of a SELECT statement.

If any of the expression values are the same as the expression value of a SELECT statement, the unit is executed.

OTHERWISE unit

If all the expression values in a WHEN statement are different from the expression value of a SELECT statement, the OTHERWISE statement will be executed.

If there is no OTHERWISE statement, the SELECT statement will terminate.

unit

Statements to be executed if the WHEN or OTHERWISE statement is met.

A unit can be a single statement, a do-group, or a begin-block.