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!

ORA-02266: unique/primary keys in table referenced by enabled foreign keys

948207Apr 8 2013 — edited Apr 8 2013
Hi,
I am trying to delete data from a table by dropping a partition. I have identified all the child tables by running the following command.

select 'select count(*) from '||table_name||' where employee_id = 100;'
from dba_constraints
where constraint_type='R'
and r_constraint_name in
(select constraint_name from dba_constraints
where constraint_type in ('P','U') and table_name='EMPLOYEE);


'SELECTCOUNT(*)FROM'||TABLE_NAME||'WHEREEMPLOYEE_ID_ID=100;'
-----------------------------------------------------------------------------------------------
select count(*) from PT_ORDERS where employee_id = 100;
select count(*) from PT_DEP where employee_id = 100;
select count(*) from PT_SKILLSET where employee_id = 100;

I dropped the partition for employee_id 100 in all of the child tables. The select count(*) returns 0 rows for each of the above.

When I try to run the below command on the EMPLOYEE table, I get 'ORA-02266: unique/primary keys in table referenced by enabled foreign keys'.

alter table EMPLOYEE drop partition EMP_ID_100;

I cant see why I am unable to drop this partition now as there is now child data in any of the referenced tables. Any suggestions or help on this would be greatly appreciated.

Thanks.

Rgs,
Rob
This post has been answered by Dmitry_Nikiforov on Apr 8 2013
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 6 2013
Added on Apr 8 2013
2 comments
4,708 views