-20523 TABLE table-name WAS SPECIFIED AS A HISTORY TABLE, BUT THE TABLE DEFINITION IS NOT VALID FOR A HISTORY TABLE. REASON CODE = reason-code.
Explanation
A table is specified as a history table in a CREATE TABLE statement or an ALTER TABLE statement, but the table definition is invalid.
- table-name
- The name of the table.
- reason-code
- A numeric value that indicates the requirement that might make the definition invalid:
- 1
- The table must not be any of the following tables:
- System-period temporal table. The table was defined as a system-period temporal table by a previous statement, or the current statement defines the table as a system-period temporal table.
- History table.
- Declared global temporary table.
- Created global temporary table.
- Materialized query table.
- View.
- Auxiliary table.
- Clone table.
- Table that has a clone.
- Table that was implicitly created for an XML column.
- 2
- The table definition must be complete.
- 3
- The table must be the only table in the table space.
- 4
- The table must not contain any of the following columns:
- Identity column
- Row change timestamp column
- Row begin column
- Row end column
- Transaction start ID column
- 5
- The table must not include a period definition.
- 6
- The table must not be involved in any referential integrity constraints.
- 7
- The history table must have the same number and order of columns as the table that is to be used as a system-period temporal table.
- 8
- The table must not contain a security label column.
- 9
- If a column in the system-period temporal table is defined as ROWID, the corresponding history column must be defined as ROWID with the GENERATED ALWAYS attribute.
- 10
- The corresponding columns of the system-period temporal table and associated history table must
have the same value for the following attributes:
- Column name
- Data type
- Data type length (excluding inline LOB length or XML length in the base table), precision, and scale
- Null attribute
- Hidden attribute
- Field procedure
- FOR MIXED, BIT, or SBCS DATA attribute and CCSID
- 11
- The table must not have a column mask or row permission.
System action
The statement cannot be processed.
User response
Correct the syntax, and resubmit the statement.
SQLSTATE
428HX