@EVAL
Use the @EVAL
function to select a value based on a series of independent tests. There is no limit to the number of conditions you can test. If the number of cases is large, list the most frequently encountered conditions first for best performance.
For this function, Oracle GoldenGate supports the use of an escape sequence to represent characters in a string column in Unicode or in the native character encoding of the Microsoft Windows, UNIX, and Linux operating systems. The target column must be a SQL Unicode data type if any argument is supplied as Unicode.
Syntax
@EVAL (condition, result [condition, result] [, ....] [, default_result])
-
condition
-
A conditional test using standard conditional operators. More than one condition can be specified.
-
result
-
A value or string to return based on the results of the conditional test. Enclose literals within single quote marks. Specify a result for each condition that is used.
-
default_result
-
A default result to return if none of the conditions is satisfied. A default result is optional.
- Examples
-
In the following example, if the
AMOUNT
column is greater than 10000, a result ofhigh amount
is returned. IfAMOUNT
is greater than 5000 (and less than or equal to 10000), a result ofsomewhat high
is returned (unless the prior condition was satisfied). If neither condition is satisfied, aCOLUMN_MISSING
indication is returned because a default result is not specified.AMOUNT_DESC = @EVAL (AMOUNT > 10000, 'high amount', AMOUNT > 5000, 'somewhat high')
-
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 ifAMOUNT
is less than or equal to 5000.@EVAL (AMOUNT > 10000, 'high amount', AMOUNT > 5000, 'somewhat high', 'lower')