Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to disable constraints in oracle 1

Status
Not open for further replies.

goodfriend

Programmer
Sep 25, 2003
3
US
for a given set of tables?

Here is a description of my problem:

Tables:

A B C
COL-PK COL-PK COL-PK
COL-A1 COL-A1 COL-A1
COL-B1 COL-B1 COL-A2

I have the relationships defined in the following way:
1.A.COL-PK=COL-A1
2.C.COL-A1=COL.PK

Now I know how to turn off constraint 1, however, because I am iterating through all 3 tables , I do not know how to turn off the constraint 2 while working on Table A.

I know that before execution I can turn off constraints on all the tables in the schema and then enable all of them but its too slow.

Therefore in summary the question is given Table A how can I turn off all the constraints that are dependent on Table A?

Please advice.
 
To disable primary keys that have dependent foreign keys:

"alter table TableA disable primary key cascade;"

If you have foreign keys pointing to a (multi-column) UNIQUE constraint, you can say:

"alter table TableA disable unique(col1, col2) cascade;"

You may also disable them by constraint name:

"alter table TableA disable constraint SYS_C00nnnn cascade;"

Cheers,

Dave

 
Thanks that helped, also after the insert I am executing alter table TableA enable primary key;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top