Multiple-Column Constraint Format

Use the multiple-column constraint format to associate one or more columns with a constraint. This alternative to the single-column constraint format allows you to associate multiple columns with a constraint.

This syntax fragment is part of the CREATE TABLE statement and the OF TYPE Clause.
(1)
Multiple-Column Constraint Format

1 
2.1 NOT NULL
2.1 NULL
2.1 UNIQUE
2.1 1 DISTINCT
2.1 PRIMARY KEY
2.1  %REFERENCES Clause2
1  ( + , column )
1  FOREIGN KEY  ( + , column )  %REFERENCES Clause2
1  %CHECK Clause3
2 1  %Constraint Definition4
Notes:
Element Description Restrictions Syntax
column Columns on which to place constraint Not BYTE, TEXT, BLOB, CLOB Identifier
A multiple-column constraint has these cardinality and size restrictions:
  • It can specify no more than 16 column names.
  • In HCL OneDB, the maximum total length of the list of columns depends on the page size, according to this formula:
    MAXLength = (((PageSize - 93)/5) -1)
    • For a page size of 2K, the total length cannot exceed 390 bytes.
    • For a page size of 16K, the total length cannot exceed 3257 bytes.
Here the slash ( / ) symbol represents integer division.

When you define a unique constraint (by using the UNIQUE or DISTINCT keyword), a column cannot appear in the constraint list more than once.

Using the multiple-column constraint format, you can perform these tasks:
  • Create data-integrity constraints for a set of one or more columns
  • Declare a mnemonic name for a constraint
  • Specify the constraint-mode option that controls the behavior of a constraint during insert, delete, and update operations.

When you use this format, you can create composite primary and foreign keys, or define check constraints that compare data in different columns.

See also the section Differences Between a Unique Constraint and a Unique Index.