简体   繁体   中英

Error 532 DB2 exception

When I tried to delete something in my DB2, this message appeared:

-532 THE RELATIONSHIP constraint-name RESTRICTS THE DELETION OF ROW WITH RID X rid-number

What does this error mean and how can I resolve it?

What is the correct way to delete from my DB2? This is how I'm doing it now:

DELETE FROM LN_WIP WHERE NUM IN (500018605, 500018605, 500018605 ); –

Yep, you are most likely trying to delete a parent row, that has children rows. Please read IBM Error Codes .

There is a foreign key relationship that is preventing the deletion of the parent row.

To find out which FK is preventing you from deleting the row, first you can list all the exported foreign keys in that table:

select
  substr(tabname,1,20) table_name,
  substr(constname,1,20) fk_name,
  substr(REFTABNAME,1,12) parent_table,
  substr(refkeyname,1,20) pk_orig_table,
  fk_colnames 
 from syscat.references where reftabname = 'LN_WIP';

Please post the result of this query. One of these is the culprit FK.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM