Constraints and Integrities
The two types of integrities for tables and their error-handling characteristics are as follows:
Integrities created using the CREATE TABLE and ALTER TABLE statement options
These integrities are specified at the time the table is created or altered. An attempt to update the table with a row containing a value that violates the constraint causes the DBMS Server to abort the entire statement and issue an error.
Integrities created using the CREATE INTEGRITY statement
These integrities are specified after the table is created. An attempt to update the table with a row containing a value that violates the constraint causes the invalid row to be rejected. No error is issued.
The two types of integrities handle nulls differently: check constraints (created using the CREATE TABLE or ALTER TABLE statement) allow nulls by default, whereas integrities created using the CREATE INTEGRITY statement do not allow nulls by default.
In addition to table constraints, use rules to perform integrity checks when a table is updated.
Note: The CREATE TABLE and ALTER TABLE statements are the ANSI/ISO SQL-92-compliant methods for maintaining database integrity.
Last modified date: 08/29/2024