Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> RE: Disable/Enable scripts?

RE: Disable/Enable scripts?

From: Mercadante, Thomas F <thomas.mercadante_at_labor.state.ny.us>
Date: Thu, 23 Dec 2004 14:14:45 -0500
Message-ID: <C9995D8C5E0DDA4A8FF9D68EE666CE0702A97189@exchsen0a1ma>


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

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US