1.0

Table Of Contents
Table Constraint
This constraint allows you to specify table-level constraints, including the primary key, a unique key, or a foreign
key. Alternatively a check constraint can be specied that is tested for each INSERT, UPDATE, and DELETE
operation.
[ CONSTRAINT constraint-name ]
{
CHECK ( boolean-expression ) |
{
PRIMARY KEY ( column-name [ , column-name ]* ) |
UNIQUE ( column-name [ , column-name ]* ) |
FOREIGN KEY ( column-name [ , column-name ]* )
REFERENCES table-name [ ( column-name [ , column-name ]* ) ]
[ ON DELETE RESTRICT ]
}
}
The boolean expression that is specied in the constraint cannot be dynamic and so cannot contain dynamic
parameters, date/time functions, user functions, or sub-queries. SQLFire only supports ON DELETE RESTRICT
for foreign key references, and can be optionally specied that way. SQLFire checks dependent tables for foreign
key constraints. If any row in a dependent table violates a foreign key constraint, the transaction is rolled back
and an exception is thrown.
Note:
SQLFire does not support cascade deletion.
Column Constraint
This constraint species a column-level constraint much like the table-level constraints except that it can refer
to only the current column (except for the check constraint). Table-level constraints, on the other hand, allow
you to specify multiple columns.
{
NOT NULL |
[ [ CONSTRAINT constraint-name ]
{
CHECK ( boolean-expression ) |
{
PRIMARY KEY |
UNIQUE |
REFERENCES table-name [ ( column-name [ , column-name ]* ) ]
[ ON DELETE RESTRICT ]
}
}
}
The check constraint above has the same format and restrictions as for the case of table constraints. SQLFire
only supports ON DELETE RESTRICT for foreign key references. SQLFire checks dependent tables for
foreign key constraints. If any row in a dependent table violates a foreign key constraint, the transaction is rolled
back and an exception is thrown.
Examples of Constraints
-- column-level primary key constraint named OUT_TRAY_PK:
CREATE TABLE SAMP.OUT_TRAY
(
SENT TIMESTAMP,
DESTINATION CHAR(8),
453
SQL Language Reference