[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.
Cheers,
Kerry
Kerry Zhan Focal Point Moderator Information Builders, Inc.