DBAsupport.com Forums - Powered by vBulletin
Results 1 to 4 of 4

Thread: ORA-02298 (Urgent!)

Hybrid View

  1. #1
    Join Date
    Dec 2000
    Posts
    21
    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.

  2. #2
    Join Date
    Oct 2000
    Location
    Saskatoon, SK, Canada
    Posts
    3,925
    *Cause: an alter table validating constraint failed because the table has orphaned child records.

    *Action: Obvious


    Sam
    Thanx
    Sam



    Life is a journey, not a destination!


  3. #3
    Join Date
    Dec 2000
    Posts
    21
    The database is on AIX 4.3.3.

  4. #4
    Join Date
    Jun 2000
    Location
    Madrid, Spain
    Posts
    7,447
    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]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Click Here to Expand Forum to Full Width