How to update DB2 table with a duplicate primary key?


To maintain the integrity of a DB2 table the primary key is always unique in the entire table. For example, if we have a DB2 table ORDERS which stores all the orders and the primary key of the table is column ORDER_ID. Then there can be only a single row having a particular order id. This will be useful to identify an order distinctly.

If we try to insert or update a row in a DB2 table having duplicate primary key using a COBOL-DB2 program, we will get DB2 error code -803. As per the IBM documentation - 803 error code states the following−

“Unique index violation. Try to insert duplicate record (Duplicate Error)”

Updated on: 14-Sep-2020

535 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements