odbc problem with DB2 cannot upsert due to Index error

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
abhilashnair
Participant
Posts: 284
Joined: Fri Oct 13, 2006 4:31 am

odbc problem with DB2 cannot upsert due to Index error

Post by abhilashnair »

I am trying to load DB2 table in Upsert method. Updates are happening first and then Inserts. I am getting the error

INDEX1 RESTRICTS COLUMNS WITH SAME VALUES. TABLE NAME

But if it is Update Then Insert then why is this issue happening?
Even if there are duplicates in my source, the problem should happen only if the Option selected was Insert Then Update or Insert Only

Not sure why it is happening here though?
abhilashnair
Participant
Posts: 284
Joined: Fri Oct 13, 2006 4:31 am

Post by abhilashnair »

When I changed the partitioning to Hash, hash keys were same as the update keys used in the query, the error went away.

This is strange. The partitioning was Auto previosuly and the job used to work fine. Can this be explained?
blewip
Participant
Posts: 81
Joined: Wed Nov 10, 2004 10:55 am
Location: London

Post by blewip »

Is it possible the input data has duplicate rows. Therefore there are two copies of the same primary keys. Both are tried to be updated and fail, so both become inserts?

I know strictly speaking you may not expect this to happen.
Modern Life is Rubbish - Blur
abhilashnair
Participant
Posts: 284
Joined: Fri Oct 13, 2006 4:31 am

Post by abhilashnair »

Assuming this to be true, Do you mean both duplicates tried to insert at the same time ? How did Hash Partition resolve this then ?
blewip
Participant
Posts: 81
Joined: Wed Nov 10, 2004 10:55 am
Location: London

Post by blewip »

Not necessarily. I was saying that both updates were tried (and failed) before either insert occurred.

I take it that de-duping the data would also fix the problem.
Modern Life is Rubbish - Blur
Post Reply