How is a constraint enabled?
How is a constraint enabled?
Rating:
A constraint is enabled using the ENABLE clause of the ALTER TABLE statement. When enabling a constraint, the VALIDATE or NOVALIDATE keyword can be used with the ENABLE clause.
The VALIDATE keyword specifies that all existing rows in the table and new rows inserted in the table must comply with the constraint. Therefore, when enabling a constraint by using the ENABLE VALIDATE clause, if any row in the table violates the constraint, the constraint remains disabled and Oracle returns an error. If all rows comply with the constraint, Oracle enables the constraint. Subsequently, if a new row being inserted in the table does not comply with the constraint, the row insertion fails and Oracle returns an error.
The NOVALIDATE keyword specifies that the existing rows in the table may violate the constraint. However, new rows inserted in the table must comply with the constraint.
Rating:
Other articles
- What is object privilege?
- What is an undo segment?
- What is instance recovery?
- What is library cache ?
- How is a constraint disabled?