-546 THE CHECK CONSTRAINT constraint-name IS INVALID
Explanation
A check constraint in the CREATE TABLE or ALTER
TABLE statement is invalid for one or more of the following reasons:
- The constraint definition refers to a column that has a field procedure.
- The constraint definition refers to a column with a data type
that is lower in the hierarchy of numeric data types than the data
type of any other operand. The hierarchy is as follows:
small integer < large integer < decimal < single precision float < double precision float
- The constraint definition refers to a column with a numeric data type that is not the same numeric data type as that of the other column operands.
- The constraint definition refers to a column with a length that is shorter than the other operands when the column and other operands are not character string data types.
- The constraint definition refers to a DECFLOAT column.
- The constraint definition refers to a built-in or user-defined function.
- The constraint definition uses a cast function that requires conversion of the data. The only functions that are allowed in a check constraint are cast functions that do not require conversion of the data.
- The constraint contains an XML column
- The constraint definition contains an XMLQuery expression.
- constraint-name
- The name of the check constraint.
System action
The statement cannot be processed.
For ALTER TABLE, the check constraint is not added to the object table. The definition of the table is unchanged.
For CREATE TABLE, the table is not created.
Programmer response
Correct the check constraint definition and execute the statement again.
SQLSTATE
42621