With temporary tables, you can only use a restricted number of SQL statements for data definition. These include the existence check and statements for creating and deleting tables.
Decide whether the SQL data definition statement can be removed or whether a permanent table should be created instead of the temporary table.