Call now: 252-767-6166  
Oracle Training Oracle Support Development Oracle Apps

 E-mail Us
 Oracle Articles

 Oracle Training
 Oracle Tips

 Oracle Forum
 Class Catalog

 Remote DBA
 Oracle Tuning
 Emergency 911
 RAC Support
 Apps Support
 Oracle Support

 SQL Tuning

 Oracle UNIX
 Oracle Linux
 Remote s
 Remote plans
 Application Server

 Oracle Forms
 Oracle Portal
 App Upgrades
 SQL Server
 Oracle Concepts
 Software Support

 Remote S


 Consulting Staff
 Consulting Prices
 Help Wanted!


 Oracle Posters
 Oracle Books

 Oracle Scripts

Don Burleson Blog 







Oracle Disable Constraints

Oracle Tips by Burleson Consulting

There are multiple ways to disable constraints in Oracle.

The "alter table" disable constrains syntax can be used to disable constraints in Oracle

alter table
DISABLE constraint

Another way to enable and disable constraints in Oracle would be to either use a plsql block or write a script.

Here is a script that makes use of Oracle disable constraint:

for i in (select constraint_name, table_name from user_constraints) LOOP
execute immediate 'alter table '||i.table_name||' disable constraint '||i.constraint_name||'';
end loop;

or here is an alternate example of Oracle disable constraints:

select 'alter table '||table_name||' disable constraint '||constraint_name||';' from user_constraints;

Be careful when disabling constraints in Oracle, because of the implicit commits in DDL statements like this, sometimes you will find it necessary to "cache" the results of the cursor before starting to execute the DDLs used to disable constraints and avoid "snapshot too old" errors. This only happen occasionally, but if it does use this method to disable constraints in Oracle:

  Type    varchar2Array is table of varchar2(1000) index by binary_integer;
  tabCons mypkg.varchar2Array;
select constraint_name Bulk Collect Into tabCons
  select constraint_name
  from    user_constraints
  where table_name = :tab_name
  If    tabSQL.count > 0 Then
      For    numCount in tabCons.first .. tabCons.Last
          Execute Immediate 'alter table '||:tab_name||' disable constraint '||tabCons(numCount);
      end loop;
  End If;

The last way to disable constraints in Oracle would be to create a procedure to disable constraints. Prior to using this method to disable constraints all foreign keys must be disabled.  An error would result from using this method to disable constraints if a pk is disabled while an fk is referring to it.

Oracle disable constraint


View more of my notes related to disabling Oracle constraints here:

Oracle "alter table" constraint syntax examples

Enabling and Disabling Constraints

Overhead of Constraints on DML Performance







Oracle training Excel
Oracle performance tuning software 


Burleson is the American Team

Note: This Oracle documentation was created as a support and Oracle training reference for use by our DBA performance tuning consulting professionals.  Feel free to ask questions on our Oracle forum.

Verify experience! Anyone considering using the services of an Oracle support expert should independently investigate their credentials and experience, and not rely on advertisements and self-proclaimed expertise. All legitimate Oracle experts publish their Oracle qualifications.

Errata?  Oracle technology is changing and we strive to update our BC Oracle support information.  If you find an error or have a suggestion for improving our content, we would appreciate your feedback.  Just  e-mail:  and include the URL for the page.


Burleson Consulting

The Oracle of Database Support

Oracle Performance Tuning

Remote DBA Services


Copyright ? 1996 -  2014

All rights reserved by Burleson

Oracle ? is the registered trademark of Oracle Corporation.