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

Home -> Community -> Usenet -> c.d.o.server -> Re: A Primary Key and Foreign key

Re: A Primary Key and Foreign key

From: Diego Pafumi <dpafumi_at_us.oracle.com>
Date: Tue, 01 Dec 1998 13:18:31 -0800
Message-ID: <36645D27.D270ACB1@us.oracle.com>


That was excellent !!!!!! But.......
And how can I do to disable the triggers???

Robert Liziniewicz wrote:

> You can disable all foreign key constraints
> on a schema using script like the following:
> ------------------------
> set pages 0
> set feedback off
>
> spool x.sql
> select 'alter table '||table_name||' disable constraint '||constraint_name
> ||';'
> from user_constraints where status = 'ENABLED' and constraint_type = 'R';
> spool off
> set feedback on
> @@x
> -- just check if all constraints were disabled
> select status,count(*) from user_constraints
> group by status;
> ------------------------
>
> of course there's another script to turn the constraints on again
> ------------------------
> set pages 0
> set feedback off
>
> spool x.sql
> select 'alter table '||table_name||' enable constraint '||constraint_name
> ||';'
> from user_constraints where status = 'DISABLED' and constraint_type = 'R';
> spool off
> set feedback on
> @@x
> -- just check if all constraints were enabled
> select status,count(*) from user_constraints
> group by status;
> ------------------------
>
> I suggest not to disable PK, nor CHECK constraints - You'll have better
> view on the load process and avoid duplicates or inapropriate values.
>
> Remember about disabling triggers also!!!!
>
> Best Regards,
> Robert
>
> --
> Robert Liziniewicz C.I. HTS-ComArch
> Robert.Liziniewicz_at_ci.comarch.pl ul. Ujastek 10, Krakow
> tel. (+48 12) 644-66-31
> (+48 601) 47-86-81
Received on Tue Dec 01 1998 - 15:18:31 CST

Original text of this message

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