-20555 AN ARCHIVE-ENABLED TABLE IS NOT ALLOWED IN THE SPECIFIED CONTEXT. REASON CODE reason-code.

Explanation

The statement or query cannot reference an archive-enabled table for the indicated reason.

reason-code
A numeric value that identifies the reason for the error. reason-code can have one of the following values:
1

Start of changeAn SQL statement that requests historical data cannot reference both an archive-enabled table and a temporal table. (The temporal table can be either a system-period temporal table or an application-period temporal table.) For example, a query, a view definition, or an INSERT, UPDATE, or DELETE statement cannot reference both of these table types.End of change

Start of change

FL 507 SELECT statements are not subject to this restriction in the following specific situations, where no historical data is requested:

  • If an application-period temporal table is referenced, a FOR BUSINESS TIME period is not specified, and the CURRENT TEMPORAL BUSINESS_TIME special register is NULL.
  • If a system-period temporal table is referenced, a FOR SYSTEM TIME period is not specified, and the CURRENT TEMPORAL SYSTEM_TIME special register is NULL.
  • If an archive-enabled table is referenced, the SYSIBMADM.GET_ARCHIVE global variable is set to 'N'.
End of change
2
Start of changeAn INSERT, UPDATE, or MERGE statement cannot reference an archive-enabled table as the target of its operation when the value of the SYSIBMADM.MOVE_TO_ARCHIVE global variable is Y.End of change
3
An SQL table function cannot reference an archive-enabled table when both of the following conditions are true:
  • The value of the SYSIBMADM.GET_ARCHIVE global variable is Y.
  • The value of the ARCHIVESENSITIVE bind option is YES.
4
The definition of a row permission or column mask that is activated by a data change statement or query cannot reference an archive-enabled table when both of the following conditions are true:
  • The value of the SYSIBMADM.GET_ARCHIVE global variable is Y.
  • The value of the ARCHIVESENSITIVE bind option is YES.

System action

The statement cannot be processed.

User response

Change the query or statement to remove the reference to the archive-enabled table and specify another table.

SQLSTATE

428I6