EVAL
Allows the user to select a value depending on a series of independent tests. There is no practical limit to the number of conditions. If the number of cases is large, it is beneficial to list the most frequently encountered conditions first.
Syntax
@EVAL (condition1,result1[,condition2,result2] [, ...] [,default_result])
Examples
- Example 1
-
In the following example, if
AMOUNTis greater than 10000,"high amount" is returned. IfAMOUNTis greater than5000(and less than or equal to10000),"somewhat high" is returned (unless the prior condition was satisfied). If neither condition is satisfied, aCOLUMN_MISSINGindicator is returned because a default result is not specified.AMOUNT_DESC = @EVAL (AMOUNT > 10000, "high amount", AMOUNT > 5000, "somewhat high")
- Example 2
-
The following is a modification of the preceding example. It returns the same results, except that a default value is specified, and a result of
"lower" is returned ifAMOUNTis less than or equal to5000.@EVAL (AMOUNT > 10000, "high amount", AMOUNT > 5000, "somewhat high", "lower")