Updating old record in SCD2

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
babbu9
Premium Member
Premium Member
Posts: 75
Joined: Tue Jun 01, 2004 9:44 am

Updating old record in SCD2

Post by babbu9 »

Hi
I have been working with SCD2 and have a difficulty in updating the old record and changing the delete flag on the deleted records.

We have 3 columns that track every insert/ update

for insert:
eff_date=sysdate
exp_date=null
delete_flag=No

for update:
insert new record
eff_date=sysdate
exp_date=null
delete_flag=No

old record
change exp_date=sysdate-1

for delete:
update old record
delete_flag=Yes

How will be implement this.

I am using Change capture stage but donot know
1. how to get the
keys for the old record that needs to be updated
2. Change the exp_date value to sysdate-1

For delete how to change the delete flag to yes to that particular record.

I would appreciate if you could help me by specifying what stages to use and how to implement the logic in them.

Thanks
Bob
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Getting the key should have been done upstream of the Change Capture stage via a lookup against a "business key to surrogate key" data set.

Varying the delete flag or end date then becomes a straightforward update.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply