Using logic in the data replication
GoldenGate has a number of functions that enable the administrator to program logic in the Extract and Replicat process configuration. These provide generic functions found in the IF
and CASE
programming languages. In addition, the @COLTEST
function enables conditional calculations by testing for one or more column conditions. This is typically used with the @IF
function, as shown in the following code:
MAP SRC.CREDITCARD_PAYMENTS, TARGET TGT.CREDITCARD_PAYMENTS_FACT, & COLMAP (USEDEFAULTS, & AMOUNT = @IF(@COLTEST(AMOUNT, MISSING, INVALID), 0, AMOUNT));
Here, the @COLTEST
function tests the AMOUNT
column in the source data to check whether it is MISSING
or INVALID
. The @IF
function returns 0
if @COLTEST
returns TRUE
and returns the value of AMOUNT
if FALSE
.
The target AMOUNT
column is therefore set to 0
when the equivalent source is found to be missing or invalid; otherwise, a direct mapping occurs.
The @CASE
function tests a list of values for a match...