Argument | Description |
expression | Expression. An expression whose values you want to test. Expression is compared to each valuen in turn until success or ELSE. The expression can evalute to nearly any datatype including string, numeric, date, time, datetime, or boolean. The datatype of the expression MUST match the datatype of the value list. |
WHEN (optional) | Introduces a value-result pair. At least one WHEN is required. |
valuen |
Value with same datatype as expression. One or more values that you want to compare to values of expression (value datatype must match expression datatype). A value can be:
A single value
A list of values separated by commas (for example: 2, 4, 6, 8 or: "Play","Pause","Mute")
A TO clause (for example: 1 TO 20 or: "AAA" TO "BBB")
IS followed by a relational operator and comparison value (for example: IS>5 or: IS<"DDD")
Any combination of the above with an implied OR between expressions (for example, 1,3,5,7,9,27 TO 33, IS>42) |
THEN | Introduces the result to be returned when expression matches the corresponding valuen |
resultn | Expression. An expression whose value is returned by Case for the corresponding valuen. All resultn values must have the same datatype. |
ELSE (optional) | Specifies that for any values of expression that don't match the values of valuen already specified, Case returns resultelse. |
resultelse | Expression. An expression whose value is returned by Case when the value of expression doesn't match any WHEN valuen expression. |