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.
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.
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.