All disabled foreign key constraints can not be enabled becasue of ORA-02298. The parent key exists and enabled. Any solutions would be greatly appreciated.
Printable View
All disabled foreign key constraints can not be enabled becasue of ORA-02298. The parent key exists and enabled. Any solutions would be greatly appreciated.
*Cause: an alter table validating constraint failed because the table has orphaned child records.
*Action: Obvious
Sam
The database is on AIX 4.3.3.
The data are inconsistent
Use following SQL to find inconsistent data
select distinct (FOREIGN KEY) from CHILD_TABLE
minus
select distinct (PRIMARY KEY) from PARENT_TABLE
If you have several FKs you would have to try this operation with all parent tables
The result of the query would be the data which is missing in parent table and this means that your data are INCONSISTENT
To solve this you either
Add the missing data in parent table or delete from child table
One example
you have emp and dept table (tipical) and assuming you had FK disabled
you inserted an employees who works in deptno 50 but deptno 50 does NOT exist in dept table however these two tables are related through deptno column, in order to establish again the relationship you would have to add deptno 50 in dept table or delete the employee who works in deptno 50 from emp table
HTH
[Edited by pando on 03-22-2001 at 06:01 AM]