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!

Can I enable a constraint even if there are parent keys found in parent table ?

Mohammed SardarAug 30 2014 — edited Sep 1 2014

Hi All,

I got into a very emergency situation so looking for some experts help.  I disabled a constraint and performed a delete operation on a table. But after performing I'm not able to enable the same constraint. It should be enabled. Do we have any other way to enable a constraint even if there are parent keys are not found ? Please help. I mean like FORCE Keyword we have in oracle? If we drop a type object even if there are dependencies we can remove it.  It's a foreign key constraint. The problem I dont have the parent records to insert now. Atleast can I see which are the datas violating the constraint with the master table.

The constraint details are below.

ALTER TABLE COMPONENT_MOVEMENT_HIST_LIFE ADD CONSTRAINT "FK_COMPLIFE_EXT" FOREIGN KEY ("PART_NUMBER", "SERIAL_NUMBER", "MOVEMENT_DATE", "DAY_SEQUENCE") REFERENCES "OASESANNOBON"."COMPONENT_MOVEMENT_HISTORY_EXT" ("PART_NUMBER", "SERIAL_NUMBER", "MOVEMENT_DATE", "DAY_SEQUENCE") DISABLE;

ALTER TABLE COMPONENT_MOVEMENT_HIST_LIFE

ENABLE CONSTRAINT FK_COMPLIFE_EXT;

Error starting at line 13 in command:

ALTER TABLE COMPONENT_MOVEMENT_HIST_LIFE

ENABLE CONSTRAINT FK_COMPLIFE_EXT

Error report:

SQL Error: ORA-02298: cannot validate (OASESANNOBON.FK_COMPLIFE_EXT) - 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

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 29 2014
Added on Aug 30 2014
4 comments
1,875 views