ORA-02266: unique/primary keys in table referenced by enabled foreign keys
948207Apr 8 2013 — edited Apr 8 2013Hi,
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