Using logic in data replication
GoldenGate has a number of functions that enable the administrator to program logic into the Extract and Replicat process configuration. These provide generic functions found in all programming languages, such as; IF
and CASE
. 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 example. Here the @COLTEST
function tests the AMOUNT
column in the source data to see if it is "MISSING
" or "INVALID
". The @IF
function returns a 0 if @COLTEST
returns TRUE
and the value of AMOUNT
if FALSE
.
MAP SRC.CREDITCARD_PAYMENTS, TARGET TGT.CREDITCARD_PAYMENTS_FACT, & COLMAP (USEDEFAULTS, & AMOUNT = @IF(@COLTEST(AMOUNT, MISSING, INVALID), 0, AMOUNT));
The target AMOUNT
column is therefore set to 0 when the equivalent source is found to be missing or invalid, or else a direct mapping occurs.
The @CASE
function tests a list of values for a...