Start of change

-20180   COLUMN column-name IN TABLE table-name CANNOT BE ALTERED AS SPECIFIED

Explanation

The column could not be altered.

column-name
The name of the column.
table-name
The name of the table that contains the column.

Possible reasons for this error include a violation of one of the following restrictions:

  • ALTER COLUMN cannot be specified in an ALTER TABLE statement if any of the following conditions are true:
    • The table is defined with DATA CAPTURE CHANGES.
    • The column is involved in a referential integrity constraint (either as part of the parent key or foreign key).
    • The column is involved in an extended index definition.
    • The column has a field procedure defined.
    • The column is an identity column or a row change timestamp column.
    • The column is a LOB column that is referenced in an expression-based index, and the change would reduce the inline length of the column.
    • The table is defined as a history table or system-period temporal table.
    • The column is defined as ROW BEGIN, ROW END, or TRANSACTION START ID.
    • The column is involved in a hash key definition.
  • ALTER COLUMN cannot be specified in an ALTER TABLE statement with either a SET NOT NULL or SET DATA TYPE clause if the column is defined as part of a period definition.
  • ALTER COLUMN cannot be specified in an ALTER TABLE statement with a DROP DEFAULT or SET DATA TYPE clause if both of the following conditions are true:
    • The table is defined with DATA CAPTURE CHANGES.
    • The subsystem parameter RESTRICT_ALT_COL_FOR_DCC is set to YES.
  • SET DATA TYPE cannot be specified in an ALTER TABLE statement if any of the following conditions are true:
    • The table is a materialized query table.
    • The table has an edit procedure or valid procedure.
    • The column is involved in an extended index definition.
    • VARBINARY was specified as the target data type and the column is defined with the following attributes:
      • As CHAR FOR BIT DATA, VARCHAR FOR BIT DATA, or BINARY
      • With the DESC attribute in an index

System action

The statement cannot be processed.

Programmer response

Perform one of the following actions:

  • Change the name of the column in the statement to a column that can be altered.
  • Drop and re-create the table with the necessary attributes.
  • If the column is used in an index that contains an expression, drop the index and alter the column with the necessary attributes. Then, re-create the index.

SQLSTATE

428FR

End of change