You must be trying to enable a foreign key. The error message indicates that some of the foreign key values don't correspond to primary (or unique) key values in the parent table. You have to identify the discrepancies and fix them before your foreign key will work.
To identify the discrepancies try executing a query like
select foreign_key_col from your_table
minus
select primary_key_col from parent_table;
After you identify the discrepencies you must fix them. That essentially means either adding new primary keys to the parent table or removing unmatched foreign keys from the child table.
If you only want the constraint to apply to new inserts/updates made to the table, and don't care if data already in table complies or not, you can use the "ENABLE NOVALIDATE" clause in your ALTER statment that adds the constraint.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.