A select-group provides a multiple path conditional branch. A select-group contains a SELECT statement, optionally one or more WHEN statements, optionally an OTHERWISE statement, and an END statement.
Abbreviation: OTHER for OTHERWISE
If an expression is found that is equal to the saved value, the evaluation of expressions in WHEN statements is terminated, and the unit of the associated WHEN statement is executed. If no such expression is found, the unit of the OTHERWISE statement is executed.
The WHEN statement must not have a label.
If the OTHERWISE statement is omitted and execution of the select-group does not result in the selection of a unit, the ERROR condition is raised.
The OTHERWISE statement must not have a label or condition prefix.
If exp1 is omitted, each exp2 is evaluated and converted, if necessary, to a bit string. If any bit in the resulting string is '1'B, the unit of the associated WHEN statement is executed. If all bits are 0 or the string is null, the unit of the OTHERWISE statement is executed.
After execution of a unit of a WHEN or OTHERWISE statement, control passes to the statement following the select-group, unless the normal flow of control is altered within the unit.
If exp1 is specified, each exp2 must be such that the following comparison expression has a scalar bit value:
(exp1) = (exp2)
Both exp1 and exp2 must be scalar expressions. Hence, while arrays, structures, and unions may be used in either exp1 or exp2, the evaluated expression must be a scalar value.