How to update DB2 table with a duplicate primary key?

DB2DatabaseBig Data Analytics

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)”
raja
Published on 14-Sep-2020 13:58:48
Advertisements