If you’ve ever gotten a DB2 error like this…
SQL0803N One or more values in the INSERT statement, UPDATE statement, or foreign key update caused by a DELETE statement are not valid because the primary key, unique constraint or unique index identified by "1" constrains table "XX.TABLE_NAME" from having duplicate values for the index key. SQLSTATE=23505
You may be asking yourself, but exactly which unique index is causing the problem?
Use the info from the error along with this query to find out:
SELECT * FROM SYSCAT.INDEXES WHERE IID = 1 AND TABSCHEMA = 'XX' AND TABNAME = 'TABLE_NAME';
Of course you will want to replace the WHERE clause conditions with your values.Please remember to subscribe to the newsletter to stay up to date!
You or someone you know looking to buy or sell?
Disclaimer: Thoughts and opinions are my own, and do not reflect the views of any employer, family member, friend, or anyone else. Some links may be affiliate links, but I don't link to anything I don't use myself. You would think this should be self evident these days, but apparently not...