Upsert without a Unique Constraint on DB2 Table
Posted: Fri Feb 29, 2008 3:05 pm
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
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