Mega Code Archive

 
Categories / Oracle PLSQL Tutorial / Table
 

Enabling a Constraint

You can enable an existing constraint using the ENABLE CONSTRAINT clause of ALTER TABLE. To enable a constraint, all the rows in the table must satisfy the constraint. 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> ALTER TABLE myTable   2  ENABLE CONSTRAINT uq; Table altered. SQL> SQL> drop table myTable   2  / Table dropped. SQL>