ADD check-constraint
- CONSTRAINT constraint-name
- Names the constraint. A constraint-name must not identify a
constraint that already exists at the current server. The constraint-name must be unique within a schema.
If not specified, a unique constraint
name is generated by the database manager.
- CHECK(check-condition)
- Defines a check constraint. The check-condition must be true
or unknown for every row of the table.
The check-condition is a search-condition, except:
- It can only refer to columns of the table and the column names must not
be qualified.
- It cannot reference ROWID or DATALINK with FILE LINK CONTROL columns.
- It must not contain any of the following:
- Subqueries
- Aggregate functions
- Variables
- Parameter markers
- Complex expressions that contain LOBs (such as concatenation)
- CURRENT DEBUG MODE, CURRENT DEGREE, CURRENT SCHEMA, CURRENT
SERVER, CURRENT PATH, SESSION_USER, SYSTEM_USER, and USER special registers
- CURRENT DATE, CURRENT TIME, CURRENT TIMESTAMP, and CURRENT TIMEZONE special
registers
- User-defined functions other than functions that were implicitly generated
with the creation of a distinct type
- NOW, CURDATE, and CURTIME scalar functions
- DBPARTITIONNAME scalar function
- ATAN2, DIFFERENCE, RAND, RADIANS, and SOUNDEX scalar functions
- DLVALUE, DLURLPATH, DLURLPATHONLY, DLURLSERVER, or DLURLSCHEME scalar
functions
- DLURLCOMPLETE scalar function (for DataLinks with an attribute of FILE
LINK CONTROL and READ PERMISSION DB)
- DECRYPT_BIT, DECRYPT_BINARY, DECRYPT_CHAR, DECRYPT_DB, ENCRYPT_RC2,
ENCRYPT_TDES, and GETHINT
- DAYNAME, MONTHNAME, NEXT_DAY, and VARCHAR_FORMAT
- INSERT, REPEAT, and REPLACE
- GENERATE_UNIQUE and RAISE_ERROR
For more information about search-condition, see Search conditions.
(C) Copyright IBM Corporation 1992, 2006. All Rights Reserved.