Disabling Constraints
The subsequent CREATE and ALTER TABLE statements both define and disable integrity constraints:
CREATE TABLE emp (
empno NUMBER(5) PRIMARY KEY DISABLE, . . . );
ALTER TABLE emp
ADD PRIMARY KEY (empno) DISABLE;
The both statements describe the employee number to be primary key but initially it is disabled.
Enabling and Disabling is Defined Integrity Constraints
Use the ALTER TABLE command to
•enable a disabled constraint by using the ENABLE clause
•disable an enabled constraint by using the DISABLE clause
Enabling Disabled Constraints
The subsequent statements are the examples of statements which enable disabled integrity constraints:
ALTER TABLE dept
ENABLE CONSTRAINT dname_ukey;
ALTER TABLE dept ENABLE PRIMARY KEY, ENABLE UNIQUE (dname, loc);
The both two statements try to enable the constraints.
ALTER TABLE statements which will attempts to enable an integrity constraint fail when the rows of the table violate the integrity constraint.