Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Unable to enable constraint

user11334489Jun 12 2020 — edited Jun 12 2020

Hi Team,

I am getting below error while enabling the constraint(ALTER TABLE child ENABLE CONSTRAINT fk_sup) in the child table.

SQL Error: ORA-02298: cannot validate  - parent keys not found

02298. 00000 - "cannot validate (%s.%s) - parent keys not found"

*Cause:    an alter table validating constraint failed because the table has

           child records.

*Action:   Obvious

I checked the parent and child table.

The common value(Reference kay value) is available in both table.

There is no data in the below query result.

SELECT

    *

FROM

    inv.child c

WHERE

    NOT EXISTS (

        SELECT

            1

        FROM

            inv.parent p

        WHERE

            p.mk_id = c.mk_id

    );

I am using Oracle 12c Database.

How to resolve this issue.

Thank in Advance.

Best Regards,

Abu

Comments
Post Details
Added on Jun 12 2020
3 comments
1,836 views