The SETIMAGE function select the CDC Image (BEFORE or AFTER) to be used as the source (or target) datastore which makes it possible to use the same PROC for both images. The SETIMAGE function returns FALSE if you specify BEFORE and the CDC record is not an update (change).
Category
Specialized
Syntax
SETIMAGE (['BEFORE'] | ['AFTER'])
Parameter and Description
Parameter | Description |
---|---|
'BEFORE' | 'AFTER' | Specifies that subsequent operations will reference either the 'BEFORE' or 'AFTER' values of items in the source CDC record. |
Example
Map the contents of both the BEFORE and AFTER values of a CDC Update record to separate Before and After columns in a target DESCRIPTION.
SETIMAGE('BEFORE')
CALLPROC PROCESS DEPT_REORG
SETIMAGE('AFTER')
CALLPROC PROCESS DEPT_REORG
CREATE PROC DEPT_REORG AS SELECT
{
T_DEPT.DEPTNO = DEPT.DEPTNO
T_DEPT.DEPTNAME = DEPT.DEPTNAME
...
APPLY (Target, T_DEPT)
}
FROM CDCIN;
Note: Function @BEFORE simplifies referencing individual BEFORE values of specific fields.