Upsert problem

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
weiven
Participant
Posts: 5
Joined: Wed Oct 13, 2004 1:55 am

Upsert problem

Post by weiven »

Im trying to INSERT value from Sequential file to Oracle9i using method UPSERT.

For UPSERT method, it should only insert data that does not exist in the database.

My problem is, why it INSERT duplicate value into the database when i rerun it again?

Plz help!? :? :?
weiven
tonystark622
Premium Member
Premium Member
Posts: 483
Joined: Thu Jun 12, 2003 4:47 pm
Location: St. Louis, Missouri USA

Post by tonystark622 »

Check and make sure that you have the right columns defined as keys.

Good Luck!
Tony
prabu
Participant
Posts: 146
Joined: Fri Oct 22, 2004 9:12 am

Re: Upsert problem

Post by prabu »

weiven wrote:Im trying to INSERT value from Sequential file to Oracle9i using method UPSERT.

For UPSERT method, it should only insert data that does not exist in the database.

My problem is, why it INSERT duplicate value into the database when i rerun it again?
duplicate based on what???. try trimming the values the key columns before inserting .
gh_amitava
Participant
Posts: 75
Joined: Tue May 13, 2003 4:14 am
Location: California
Contact:

Post by gh_amitava »

Hi,

It seems that in "Upsert", DataStage does update first and if not found then insert but I also faced the similar problem. In fact Datastage does an "Insert" first. So duplicate records may exists in this case. So to avoid this situation you have to handle it by Database unique key constraints.

Regards
Amitava
dsxdev
Participant
Posts: 92
Joined: Mon Sep 20, 2004 8:37 am

Post by dsxdev »

You can do a look up just before inserting and use only those records which fail to match in the lookup Stage this would solve the issue of duplicates.
Happy DataStaging
Post Reply