Focal Point
[CODE] DM - Fact Table Surrogate Key with Oracle Sequence

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/1381057331/m/8651064703

November 16, 2008, 09:13 PM
Endre
[CODE] DM - Fact Table Surrogate Key with Oracle Sequence
Many of us asking how to incorporate Data Migrator with Oracle Sequence Generator when loading Fact Tables.

This will be fully supported in DM 7.7, but meanwhile, here is one way that will help you.

Make the Surrogate_Key field of the Fact table in the Metadata "Read Only". You will ignore this field in the target transformation.

Create an Oracle Seq Generator for this field;

CREATE SEQUENCE seq_name INCREMENT BY 5 START WITH 10 ;

Create an INSERT trigger on the Fact table;

CREATE OR REPLACE
TRIGGER trigger_name BEFORE INSERT ON fact_table_name
FOR EACH ROW
BEGIN SELECT
seq_name.NETXVAL INTO :NEW."surrogate_key_col_name" FROM DUAL; END;

------
This is very similar to Microsoft Sql Server IDENTETY field type, when the database engine automatically updates the field of new records with a new sequence number.

This message has been edited. Last edited by: Kerry,


WebFocus 7.6.8
iWay Data Migrator 7.6.8
PMF 5.1
December 08, 2008, 02:10 PM
Kerry
Hi Endre,

Thanks a lot for sharing the info with all. Smiler

Cheers,

Kerry


Kerry Zhan
Focal Point Moderator
Information Builders, Inc.