SQL/MX 2.x Reference Manual (H06.04+)

SQL/MX Statements
HP NonStop SQL/MX Reference Manual540440-003
2-15
Syntax Description of ALTER TABLE
NonStop SQL/MX checks the condition whenever an operation occurs that
might affect its value. The operation is allowed if the predicate in the search
condition evaluates to TRUE or null, but is prohibited if the predicate evaluates
to FALSE. When a check constraint is added, existing data is checked for
violations.
You cannot refer to the CURRENT_DATE, CURRENT_TIME, or
CURRENT_TIMESTAMP function in a CHECK constraint, and you cannot use
subqueries in a CHECK constraint.
REFERENCES ref-spec
specifies a references column constraint. The maximum combined length of
the columns for a REFERENCES constraint is 255 bytes.
FOREIGN KEY (column-list) REFERENCES ref-spec
is a referential table constraint. A referential constraint for the table declares
that a column or set of columns (called a foreign key) in table can contain
only values that match those in a column or set of columns specified in the
REFERENCES clause.
The two columns or sets of columns must have the same characteristics (data
type, length, scale, precision), and there must be a UNIQUE or PRIMARY KEY
constraint on the column or set of columns specified in the REFERENCES
clause.
The foreign key is the column or set of columns specified in the FOREIGN KEY
clause, immediately following the FOREIGN KEY keywords.
A FOREIGN KEY constraint is enforced with a nonunique index. If there is
already a unique or nonunique index on key-column-list,
NonStop SQL/MX uses this index; if not, it creates a nonunique index.
ref-spec is:
referenced-table [(column-list)] [referential triggered
action]
referenced-table is the table referenced by the foreign key in a
referential constraint. referenced-table cannot be a view, and
referenced-table cannot be the same as table.
column-list specifies the column or set of columns in
referenced-table that corresponds to the foreign key in table. The
columns in the column list associated with REFERENCES must be in the
same order as the columns in the column list associated with FOREIGN
KEY. If column-list is omitted, the referenced table's PRIMARY KEY
columns are the referenced columns.