-526 THE REQUESTED OPERATION OR USAGE DOES NOT APPLY TO table-type TEMPORARY TABLE table-name

Explanation

Db2 assumes that the SQL statement being executed refers to a created or declared temporary table, named table-name, and the requested operation or usage in the statement is not allowed on the temporary table.
table-type
CREATED or DECLARED

CREATED is for a temporary table defined by the CREATE GLOBAL TEMPORARY TABLE statement.

DECLARED is for a temporary table defined by the DECLARE GLOBAL TEMPORARY TABLE statement.

table-name
Qualified name of the temporary table.

This error might be issued for the following reasons when table-type is CREATED:

  • If the SQL statement is a DELETE statement that specifies the fetch-clause, remove the fetch-clause from the DELETE statement.
  • Start of changeFL 502 A KEY LABEL clause is specifiedEnd of change

System action

The statement cannot be processed.

Programmer response

Modify the SQL statement to ensure that the object references are not to the indicated type of temporary table

If table-type is DECLARED and you intended table-name to refer to an existing persistent base table, you must perform one of the following actions:
  • Recreate the persistent base table table-name with a different schema qualifier
  • In the same application process, issue a DROP TABLE for table name followed by a COMMIT to drop the declared temporary table and afterwards be able to reference the persistent base table with the same table-name in the same application process
  • Remove the DECLARE GLOBAL TEMPORARY TABLE statement from the application process to use the persistent base table with the same table-name

Start of changeIf table-type is CREATED, perform the following action and issue the statement again:End of change

Start of change
  • If the SQL statement is a DELETE statement that specifies the fetch-clause, remove the fetch-clause from the DELETE statement.
  • If the SQL statement contains a KEY LABEL clause, remove the key label specification.
End of change

SQLSTATE

42995