Use the @IF function to return one of two values, based on a condition. You can use the @IF function with other Oracle GoldenGate functions to begin a conditional argument that tests for one or more exception conditions. You can direct processing based on the results of the test. You can nest @IF statements, if needed.
@IF (condition, value_if_non-zero, value_if-zero)
conditionA valid conditional expression or Oracle GoldenGate function. Use numeric operators (such as =, > or <) only for numeric comparisons. For character comparisons, use one of the character-comparison functions.
value_if_non-zeroNon-zero is considered true.
value_if_zeroZero (0) is considered false.
The following returns an amount only if the AMT column is greater than zero; otherwise zero is returned.
AMOUNT_COL = @IF (AMT > 0, AMT, 0)
The following returns WEST if the STATE column is CA, AZ or NV; otherwise it returns EAST.
REGION = @IF (@VALONEOF (STATE, 'CA', 'AZ', 'NV'), 'WEST', 'EAST')
The following returns the result of the PRICE column multiplied by the QUANTITY column if both columns are greater than 0. Otherwise, the @COLSTAT (NULL) function creates a NULL value in the target column.
ORDER_TOTAL = @IF (PRICE > 0 AND QUANTITY > 0, PRICE * QUANTITY, @COLSTAT (NULL))