DB2 Error Code – -530 the insert or update value of foreign key constraint name is invalid

In this post, you’ll learn about the error message -530 the insert or update value of foreign key constraint name is invalid in the IBM DB2 database , the reason why it occurs along with the solution to fix it

IBM DB2 Error Message

-530 the insert or update value of foreign key constraint name is invalid

Reason for the Error

An UPDATE or INSERT operation attempted to place a value in a foreign key of the object table; however, this value was not equal to some value of the primary key of the parent table.When a row is inserted into a dependent table, the insert value of a foreign key must be equal to the value of the primary key of some row of the parent table in the associated relationship.When the value of the foreign key is updated, the update value of a foreign key must be equal to the value of the primary key of some row of the parent table of the associated relationship.

Solution

Ensure that INSERT row for DB2 PARENT table is completed before INSERT row in CHILD table.