RE: ENABLING FOREIGN KEY CONSTRAINTS
Title: RE: ENABLING FOREIGN KEY CONSTRAINTS > -Original Message- > From: Harvinder Singh [mailto:[EMAIL PROTECTED]] > > When we do alter table table_name disable primary key > cascade;..it also > disable all the foreign key constraints > but when we after do alter table table_name enable primary > key..it does > not enable foreign keys > is there any syntax that we can enable all th foreign keys referencing > particular table.. Use the "SQL from SQL" approach: select 'alter table "' || b.owner || '"."' || b.table_name || '" enable constraint "' || b.constraint_name || '" ;' as sql_text from dba_constraints a, dba_constraints b where a.owner = 'TABLE_WITH_PK_OWNER' and a.table_name = 'TABLE_WITH_PK_NAME' and a.constraint_type = 'P' and b.constraint_type = 'R' and b.r_owner = a.owner and b.r_constraint_name = a.constraint_name and b.status = 'DISABLED' ; The query will generate all the SQL statements you need to re-enable the foreign key constraints.
RE: ENABLING FOREIGN KEY CONSTRAINTS
Harvinder, Spool this to a file, then run it after re-enabling your PK. BTW, you could do the reverse of this to disable the FKs, too. Select 'Alter Table ' || Table_Name || ' Enable Constraint ' || Constraint_Name || ' ;' >From User_Constraints Where R_Constraint_Name = ; Jack Jack C. Applewhite Database Administrator/Developer OCP Oracle8 DBA iNetProfit, Inc. Austin, Texas www.iNetProfit.com [EMAIL PROTECTED] (512)327-9068 -Original Message- Singh Sent: Wednesday, September 26, 2001 11:40 AM To: Multiple recipients of list ORACLE-L Hi, When we do alter table table_name disable primary key cascade;..it also disable all the foreign key constraints but when we after do alter table table_name enable primary key..it does not enable foreign keys is there any syntax that we can enable all th foreign keys referencing particular table.. Thanks -Harvinder -- Please see the official ORACLE-L FAQ: http://www.orafaq.com -- Author: Jack C. Applewhite INET: [EMAIL PROTECTED] Fat City Network Services-- (858) 538-5051 FAX: (858) 538-5051 San Diego, California-- Public Internet access / Mailing Lists To REMOVE yourself from this mailing list, send an E-Mail message to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).
ENABLING FOREIGN KEY CONSTRAINTS
Hi, When we do alter table table_name disable primary key cascade;..it also disable all the foreign key constraints but when we after do alter table table_name enable primary key..it does not enable foreign keys is there any syntax that we can enable all th foreign keys referencing particular table.. Thanks -Harvinder -- Please see the official ORACLE-L FAQ: http://www.orafaq.com -- Author: Harvinder Singh INET: [EMAIL PROTECTED] Fat City Network Services-- (858) 538-5051 FAX: (858) 538-5051 San Diego, California-- Public Internet access / Mailing Lists To REMOVE yourself from this mailing list, send an E-Mail message to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).
enabling foreign key constraints
Hi, When we do alter table table_name disable primary key cascade;..it also disable all the foreign key constraints but when we after do alter table table_name enable primary key..it does not enable foreign keys is there any syntax that we can enable all th foreign keys referencing particular table.. Thanks -Harvinder -- Please see the official ORACLE-L FAQ: http://www.orafaq.com -- Author: Harvinder Singh INET: [EMAIL PROTECTED] Fat City Network Services-- (858) 538-5051 FAX: (858) 538-5051 San Diego, California-- Public Internet access / Mailing Lists To REMOVE yourself from this mailing list, send an E-Mail message to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).