update and insert

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
samsuf2002
Premium Member
Premium Member
Posts: 397
Joined: Wed Apr 12, 2006 2:28 pm
Location: Tennesse

update and insert

Post by samsuf2002 »

Hi,

I have a requirement where I want to update the existing records to 'close' which has a status 'open' and I also want to add a new record for the same key with status 'open' and current timestamp. I am using oracle stage.

So if there are 5 open records then I should have 10 records in the output with one as closed and other as open for each one.

if I use update then insert in upsert mode its either updating and if it fails then it inserts. I am trying to design two jobs one for insert and another for update. Dont know if there is any other option ....

Can anyone suggest me on this .

Thanks in advance
hi sam here
mikegohl
Premium Member
Premium Member
Posts: 97
Joined: Fri Jun 13, 2003 12:50 pm
Location: Chicago
Contact:

Post by mikegohl »

Could you send the rows down two links, one that does an update and one that does an insert. Link order should be update first. I assume that Timestamp is part of the key, so the new rows will not confilct with the updated rows.
Michael Gohl
samsuf2002
Premium Member
Premium Member
Posts: 397
Joined: Wed Apr 12, 2006 2:28 pm
Location: Tennesse

Post by samsuf2002 »

Thanks for the response Mike actually time stamp field is not a part of key here.

what I am doing right now is extracting the update and insert into two different file and then the updating and inserting the table in two seperate job, which seems to be working good.
hi sam here
mikegohl
Premium Member
Premium Member
Posts: 97
Joined: Fri Jun 13, 2003 12:50 pm
Location: Chicago
Contact:

Post by mikegohl »

Somehow, the key has to allow for two records to be in the database at the same time. What makes the rows unique in the database?
Michael Gohl
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Slowly Changing Dimension stage can do this for you.
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