Note: The @before function replaces the both CDCBEFORE and MAP_BEFORE functions.
The MAP_BEFORE function performs mapping of Before key fields only for Relational target datatstores that support modification of a key column value. It is used to support changes to the value of one or more Key fields or columns only, when using the APPLY command to write to the Target datastore. It provides the Engine the value used to "Select" the "row" that will be updated. It is most often used with the CDCBEFORE function.
Category
Specialized
Syntax
MAP_BEFORE(<before_key_value> | CDCBEFORE(<source_description>.<source_field> , '<target_description>.target_column>')
Parameters and Descriptions
Parameter | Description |
---|---|
<before_key_value> | CDCBEFORE(<source_description>.<source_field> | The value to be used for one target key column. |
'<target_description>.target_column>' | MUST be in Quotes, a target key column. |
Example
On a CDC Update that may include a change to a Relational target key column, provide the "before" value of the target keys to insure that the update replaces the existing row. When Compensation is specified, MAPBEFOER ensures that the new data is not inserted".
IF CDCOP(CDCIN) = 'U'
{
MAP_BEFORE(CDCBEFORE(EMPLOYEE.SITE_CD),'T_EMPLOYEE.SITE_CD')
MAP_BEFORE(CDCBEFORE(EMPLOYEE.STATE_CD),'T_EMPLOYEE.STATE_CD')
MAP_BEFORE(CDCBEFORE(EMPLOYEE.OFF_ZIP_CD),'T_EMPLOYEE.OFF_ZIP_CD')
}
-- EMPLOYEE.EMP_NO in this example cannot be changed and therefore is not specified above.