SQL/MX 3.2.1 Reference Manual (H06.26+, J06.15+)

SQL/MX Statements
HP NonStop SQL/MX Release 3.2.1 Reference Manual691117-005
2-116
Syntax Description of CREATE TABLE
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.
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.
referential action
RESTRICT referential action means that the referential check is
made for each row. An error is raised when the referential constraint is
violated.
ANSI SQL-99 standard: NO ACTION referential action means that
the referential check is made at the end of the SQL statement. An error is
raised when the referential constraint is violated.
NonStop SQL/MX does not support NO ACTION referential action in the
way it is specified by ANSI SQL-99. However, you can change NO
ACTION's behavior to be the same as RESTRICT by setting an
appropriate value for the Control Query Default
REF_CONSTRAINT_NO_ACTION_LIKE_RESTRICT. Options for this
attribute are:
When CASCADE is specified with the ON DELETE referential triggered
action, a row in the referencing table and its corresponding row in the
referenced-table is deleted. This maintains consistency between the
referencing and referenced tables.
OFF SQL issues an error.
SYSTEM SQL issues warning 1302, indicating that it will behave like
RESTRICT. This is the default value.
ON Makes NO ACTION behave like RESTRICT, without warnings or
errors.