Upsert without a Unique Constraint on DB2 Table

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
shawn_2008
Participant
Posts: 7
Joined: Wed Jan 16, 2008 6:50 pm

Upsert without a Unique Constraint on DB2 Table

Post by shawn_2008 »

Hello,
I have a Parallel job that reads from a sequential file and does an "Upsert" on a DB2 table based on user-defined sql. The upsert is done on a column which is not part of the primary key. Because of the way the table is partitioned, creating a unique constraint (index) on this column is not an option. When I execute the job, it inserts duplicate rows ( as far as this non-key column is concerned).

Is there a way to do an "UPSERT" without having a unique constraint on the table ?

Table: ACC_BOOKS
acc_book_no --> surrogate key
acc_book_isbn ---> ( want to do upsert based on this, cannot create unique constraint ont this)
acc_ .... --> other columns


Sequential File:
"ISBN","ACC_TRAN_COUNT"

Appreciate any help !

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

Post by ray.wurlod »

Only by checking for existence of the value within your DataStage job.
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