CDCBEFORE does not provide access to the raw data of the before image. The before image has already been processed using default and user specified data rules. This includes data type and EXTTYPE validation, error processing and code page translations. @BEFORE is most often used to implement conditional business logic based on a change to the value of a particular source field/column. It is also used to support changes to the value of a Key field or column when replicating changes to a Relational target when using the APPLY command to write to the Target datastore.
Category
Changed Data Capture
Syntax
CDCBEFORE(<source_description>.<source_field>)
Parameter | Description |
---|---|
<source_description>.<source_field> | The source field name for the data in the before image of the CDC record. |
Example 1
T_PREV_SRC_FLD1 = CDCBEFORE(SRC_FLD1)
Example 2
IF CDCBEFORE(SOURCE.STATUS) = 'OPEN' AND SOURCE.STATUS = 'CLOSED'
{
CALLPROC(CLOSING)
}
Example 3
CASE
WHEN CDCBEFORE(SRC_FLD1) = SRC_FLD1
{
CHGFLAG = 'N'
}
OTHERWISE
{
CHGFLAG = 'Y'
}