Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Mailing Lists -> Oracle-L -> RE: Disable/Enable scripts?
Bryan
Yep. You need to disable FK's before PK's
Try this:
Declare
Cursor c1 is
select 'alter table ' || table_name || ' disable constraint '
|| constraint_name sql_str
from user_constraints
where constraint_type in ('R','P')
order by constraint_type desc;
begin
for c1_rec in c1 loop
execute immediate c1_rec.sql_str;
end loop;
end;
/
Change "Disable constraint" to "enable constraint" and you're all set for enabling them.
Tom
-----Original Message-----
From: Bryan Wells [mailto:bunjibry_at_gmail.com]
Sent: Thursday, December 23, 2004 1:49 PM
To: Oracle-L
Subject: Disable/Enable scripts?
All, Im looking for a script to Disable and enable constraints. Is there an order? I would think the PK would need to be enabled first then the FK.
Thanks for your help...
Happy Holidays!
--
DBA Newbie
bunjibry_at_gmail.com
--
http://www.freelists.org/webpage/oracle-l
--
http://www.freelists.org/webpage/oracle-l
Received on Thu Dec 23 2004 - 13:13:12 CST