Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ORA-02298 cannot validate (string.string) - parent keys not found 2

Status
Not open for further replies.

mkey

Programmer
Oct 3, 2001
288
CA
Hi all,
When I tried to enable the constraint I'm getting this error:
ORA-02298 cannot validate (string.string) - parent keys not found

What should I do?

Thanks!
 
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.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top