Sie sind auf Seite 1von 2

Adding custom fields to a replicated record using SQLEXEC

Getting ready
For this recipe we will use the EMP table that is delivered in the SCOTT
schema with Oracle
binaries. In the target environment, the EMP table has an extra column called
AVG_SAL which
will be the average salary of an employee's department calculated using SQL
ran by SQLEXEC.

How to do it...
We will follow the following steps to demonstrate the use of the SQLEXEC command.
Run the following in the source environment:
1. Create an Extract process parameter file as follows:
EXTRACT EGGTEST1
USERID GGATE_ADMIN@DBORATEST, PASSWORD GGATE_ADMIN
EXTTRAIL /u01/app/ggate/dirdat/st
TABLE scott.EMP;

2. The Datapump process parameter file should look as follows:


EXTRACT PGGTEST1
USERID GGATE_ADMIN@DBORATEST, PASSWORD GGATE_ADMIN

RMTHOST stdby1-ol6-112 , MGRPORT 8809


RMTTRAIL /u01/app/ggate/dirdat/rt
TABLE scott.EMP;

3. Start the Extract and Datapump process.


Steps for the target environment are as follows:
1. Edit the Replicat process configuration as follows:
./ggsci
EDIT PARAMS RGGTEST1
REPLICAT RGGTEST1
USERID GGATE_ADMIN@TGORTEST, PASSWORD GGATE_ADMIN
DISCARDFILE /u01/app/ggate/dirrpt/RGGTEST1.dsc,append,MEGABYTES
500
ASSUMETARGETDEFS
MAP SCOTT.EMP, TARGET SCOTT.EMP, &
SQLEXEC (ID lookavg, QUERY &
"SELECT AVG(SAL) avgsal FROM SCOTT.EMP WHERE DEPTNO =(SELECT
DEPTNO FROM EMP WHERE EMPNO = :EMP_ID)" &
PARAMS (EMP_ID = EMPNO)), &
COLMAP (USEDEFAULTS, AVG_SAL = @GETVAL(lookavg.avgsal);

2. Start the Replicat process.

Das könnte Ihnen auch gefallen