check-constraint
- CONSTRAINT constraint-name
- Names the check constraint. A constraint-name must not identify
a constraint that was previously specified in the CREATE TABLE statement and
must not identify a constraint that already exists at the current server.
If the clause is not specified, a unique constraint name is generated by the
database manager.
- CHECK (check-condition)
- Defines a check constraint. At any time, 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
- 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_DEGREE, CURRENT SCHEMA, CURRENT SERVER, CURRENT PATH,
CURRENT DEBUG MODE, SESSION_USER, SYSTEM_USER, and USER special registers
- CURRENT DATE, CURRENT TIME, and CURRENT TIMESTAMP 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, RADIANS, RAND, 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.
For more information about check constraints involving LOB data types and
expressions, see the Database Programming book.
(C) Copyright IBM Corporation 1992, 2006. All Rights Reserved.