SQL/MX 3.2 Reference Manual (H06.25+, J06.14+)

SQL/MX Statements
HP NonStop SQL/MX Release 3.2 Reference Manual691117-001
2-18
Syntax Description of ALTER TABLE
REFERENCES ref-spec
specifies a references column constraint. The maximum combined length of
the columns for a REFERENCES constraint is 2010 bytes for 4K blocks and
2048 bytes for 32K blocks.
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.
update rule specifies what referential action is taken when
column-list in referenced-table is updated. If no ON UPDATE
clause is specified, a default of ON UPDATE NO ACTION is assumed.
delete rule specifies what referential action is taken when a
row in referenced-table is deleted. If no ON DELETE clause is
specified, a default of ON DELETE NO ACTION is assumed.