This content has been marked as final. Show 23 replies
Hi Sunny & Alvaro,
The sample script above take from the link you gave me does not work :(
select 'alter table 'a.owner'.'a.table_name' disable constraint 'a.constraint_name';' from all_constraints a, all_constraints b where a.constraint_type = 'R' and a.r_constraint_name = b.constraint_name and a.r_owner = b.owner and b.table_name = 'APPLICATION';
Can you try at your end if what is lacking? I suspect there should by ||' '|| ?
You can easily execute the below mentioned script as mentioned in the link
Then you can disable the constraints and latter truncate the table.
select owner,constraint_name,constraint_type,table_name,r_owner,r_constraint_name from all_constraints where constraint_type='R' and r_constraint_name in (select constraint_name from all_constraints where constraint_type in ('P','U') and table_name='TABLE_NAME');
And Close this thread if your issue is resolved.
You can use this one:
Select Table_Name,constraint_Name, Constraint_Type,r_Constraint_Name
From dba_Constraints A
Where R_Constraint_Name =(Select Constraint_Name
From dba_Constraints B
Although, why are you trying to truncate a table with hundreds of foreign keys pointing to it ? This sounds a bit strange.
The above script is the one I use, it identifies the child constraints.
Edited by: Alvaro on 09/05/2013 12:49