"Write" or as we say, "Apply" the contents of the target DESCRIPTION to the target DATASTORE.
Syntax
APPLY (<datastore_alias>, <description_alias>)
Keyword and Parameter Descriptions
Keyword | Description |
---|---|
<datastore_alias> | The name of one of the Target datastores listed in the PROCESS INTO Command. |
<description_alias> |
Specifies the alias (AS name) of a DESCRIPTION that describes the record, row or payload to be written to the Target Datastore. |
Note: All fields or columns in the Target DESCRIPTION should be mapping or initialized prior to the Apply command.
Example
Apply changes to the EMP and DEPT tables in a DB2 database to similar tables in an Oracle database that require mapping Procs with heavy transformation logic.
BEGIN GROUP HR_DB2
DESCRIPTION DB2SQL DD:DB2DDL(EMP) AS I_EMP;
DESCRIPTION DB2SQL DD:DB2DDL(DEPT) AS I_DEPT;
END GROUP;
BEGIN GROUP HR_ORA
DESCRIPTION ORASQL DD:ORADDL(EMP) AS T_EMP;
DESCRIPTION ORASQL DD:ORADDL(DEPT) AS T_DEPT;
END GROUP;
DATASTORE RDBMS
OF RELATIONAL
AS TARGET
DESCRIBED BY GROUP HR_ORA;
...
PROCESS INTO TARGET
SELECT
{
CASE DB2TBLNAME(CDCIN)
WHEN 'EMPLOYEE' { CALLPROC(P_EMP) APPLY (TARGET, T_EMP) }
WHEN 'DEPARTMENT' { CALLPROC(P_DEPT) APPLY (TARGET, T_DEPT) }
}
FROM CDCIN;