Start of change

-613   THE PRIMARY KEY OR A HASH KEY OR A UNIQUE CONSTRAINT IS TOO LONG OR HAS TOO MANY COLUMNS AND PERIODS

Explanation

The number of columns and periods that are defined for a PRIMARY KEY or UNIQUE constraint is too large. Both of the following conditions must be met:

  • The total of the number of columns and two times the number of identified periods must not exceed 64.
  • The sum of the column length attributes of the identified columns and the begin and end columns of any identified periods must not exceed the permitted limit for the type of constraint.

If the failing statement was an ALTER TABLE statement that included the SET DATA TYPE clause to alter the definition of an existing column, a column being changed is part of a unique or primary constraint. The new sum of the lengths of the columns of the keys exceeds 255-n, where n is the number of columns allowing null values. This sum currently exceeds the maximum number that is allowed.

If the failing statement was an ALTER TABLE statement with a PARTITIONING KEY specification, only 64 columns can be specified, and the combined lengths of all columns specified in the PARTITIONING KEY clause exceeds the maximum length of 255-n, where n is the number of columns that can contain null values.

The failing statement might have been either CREATE TABLE with an ORGANIZE BY HASH specification or an ALTER TABLE with an ADD ORGANIZE BY HASH specification.

System action

The statement cannot be processed.

Programmer response

Change the table definition to keep within the prescribed limits.

SQLSTATE

54008

End of change