Mega Code Archive

 
Categories / Oracle PLSQL Tutorial / Table
 

Disabling a Constraint

By default, a constraint is enabled when you create it. You can disable a constraint when you create it by adding DISABLE to the end of the CONSTRAINT clause. SQL> -- create demo table SQL> create table myTable(   2    id           NUMBER(2),   3    value        NUMBER(6,2)   4  )   5  / Table created. SQL> SQL> ALTER TABLE myTable   2  ADD CONSTRAINT uq UNIQUE (id) DISABLE; Table altered. SQL> SQL> ALTER TABLE myTable   2  DISABLE CONSTRAINT uq; Table altered. SQL> SQL> drop table myTable   2  / Table dropped. SQL>