I was told to enable foreign keys. How do I get a list of them (with status) and enable them?
The data dictionary view you want to look at is all_constraints,
I use the following query to spool out a text file that will enable all of my foreign key restraints that have been disabled
select 'alter table SCHEMANAME.' ||table_name|| ' enable constraint '||constraint_name||';'
from all_constraints where owner = 'SCHEMANAME'
and constraint_name NOT LIKE 'SYS%'
select owner,constraint_name,table_name,r_owner, r_constraint_name,status
where constraint_type='R' and owner<>'SYSTEM'
[Edited by sreddy on 01-17-2001 at 01:05 PM]
I used a combination of both of these to create.
select 'alter table FNDRYR0200.' ||table_name|| ' enable constraint '|| constraint_name||';'
where constraint_type='R' and owner = 'FNDRYR0200';
It worked real well.
Click Here to Expand Forum to Full Width