0% found this document useful (0 votes)
39 views10 pages

Create Source Table: Create Target Table

This document provides instructions for implementing a Slowly Changing Dimension (SCD) Type 2 using Oracle Data Integrator (ODI). It describes: 1) Creating source and target tables to hold the data 2) Configuring the interface in ODI to map data between the tables using an SCD Type 2 approach 3) Setting fields like start date, end date, and current flag on the target table 4) Testing the interface by making changes to source data and verifying the target is updated correctly
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
39 views10 pages

Create Source Table: Create Target Table

This document provides instructions for implementing a Slowly Changing Dimension (SCD) Type 2 using Oracle Data Integrator (ODI). It describes: 1) Creating source and target tables to hold the data 2) Configuring the interface in ODI to map data between the tables using an SCD Type 2 approach 3) Setting fields like start date, end date, and current flag on the target table 4) Testing the interface by making changes to source data and verifying the target is updated correctly
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 10

Create source table:

CREATE TABLE EMP_SCD_TYPE2_SRC AS SELECT * FROM EMP

Create Target Table:


CREATE TABLE EMP_SCD2
(
EMPNO NUMBER(4),
ENAME VARCHAR2(10 BYTE),
JOB VARCHAR2(9 BYTE),
MGR NUMBER(4),
HIREDATE DATE,
SAL NUMBER(7,2),
COMM NUMBER(7,2),
DEPTNO NUMBER(2),
START_DATE DATE,
END_DATE DATE,
CURRENT_FLAG NUMBER
)

While implementing to SCD2 ,you can see 7 slowly changing dimension Behavior.
Those are following things.

SURROGATE_KEY – Sequence Generator (Mostly in real time it should be


“ROW_WID”)
NATURAL_KEY – Primary or Unique Key (Just like you primary Key column)
OVERWRITE ON CHANGE – Column for which data needs to be updated
ADD ROW ON CHANGE – Column for which a new Surrogate Key and New rows to
generated when the data for this Column changes
CURRENT RECORD FLAG – 0 or 1 – You can define your own value (Just like Y or N)
STARTING TIMESTAMP – Column indicating the beginning of a Record’s
availability. Use SYSDATE or SYSTIMESTAMP depending on the data type.
ENDING TIMESTAMP -Column indicating the end of the Record’s availability. The
value is a default of “01 JAN 2400”
Once you have selected slowly changing dimension Behavior options in all columns in
table. then start to implement interface in Designer.
Now reverse these two tables in ODI and create one interface as INT_SCD_TYPE2

Do the normal mapping in interface. Don’t forget to select the key column that is
EMPNO 😀 .For last three column put
START_DATE= sysdate
END_DATE= to_date(‘29990101’, ‘YYYYMMDD’)
CURRENT_FLAG= 0 (0:old record, 1: Latest record)
Now open your target datastore and proceed as given in below screenshots. Select the
OLAP type as Slowly Changing Dimension.
Then expand your datastore to get all columns. Open required column one by one and
do the changes as given in below screenshots.
Next save everything and select IKM Oracle Slowly Changing Dimension in the flow
tab. Similarly CKM Oracle in the control tab.

Save interface and run it.


Now check the loaded data on target.
Hmmm. There are 14 rows inserted. Lets do some modification in the source table to
know whether its working properly or not. Here I am modifying SMITH name to
SMITHHHHHH. Its means a new row/record should be added when name changes.
Similarly update the salary of SCOTT to 9000. Here new record should not be added
instead it should be updated as we have selected overwrite on change. After changes
commit the datastore.
Run the interface again. Here you can see the same thing reflected as per our
expectation. Its your turn now. Do the changes on source side and run the interface to
get these data on target.

You might also like