Using a Search Condition

The search condition that defines a check constraint cannot contain the following elements: user-defined routines, subqueries, aggregates, host variables, or rowids. In addition, the search condition cannot contain the following built-in variant functions: CURRENT, SYSDATE, USER, CURRENT_USER, SITENAME, DBSERVERNAME, or TODAY.

When you specify a date value in a search condition, make sure you specify four digits for the year, so that the DBCENTURY environment variable has no effect on the condition. When you specify a two-digit year, the DBCENTURY environment variable can produce unpredictable results if the condition depends on an abbreviated year value. For more information about DBCENTURY, see the HCL OneDB™ Guide to SQL: Reference.

More generally, the database server saves the settings of environment variables from the time of creation of check constraints. If any of these settings are subsequently changed in a way that can affect the evaluation of a condition in a check constraint, the new settings are disregarded, and the original environment variable settings are used when the condition is evaluated.

With a BYTE or TEXT column, you can check for NULL or not-NULL values. This constraint is the only constraint allowed on a BYTE or TEXT column.