8. OpenSQL Statements : DECLARE GLOBAL TEMPORARY TABLE : Syntax
 
Share this page                  
Syntax
The DECLARE GLOBAL TEMPORARY TABLE statement has the following format:
[EXEC SQL] DECLARE GLOBAL TEMPORARY TABLE [SESSION.]table_name
              (column_name format {, column_name format})
              ON COMMIT PRESERVE ROWS
              WITH NORECOVERY
To create a temporary table by selecting data from another table:
[EXEC SQL] DECLARE GLOBAL TEMPORARY TABLE [SESSION.]table_name
              (column_name {, column_name})
              AS subselect
              ON COMMIT PRESERVE ROWS
              WITH NORECOVERY
table_name
Defines the name of the temporary table.
ON COMMIT PRESERVE ROWS
(Required) Directs the DBMS Server to retain the contents of a temporary table when a COMMIT statement is issued.
WITH NORECOVERY
(Required) Suspends logging for the temporary table.
AS subselect
Defines the subselect, as described in Select (interactive) (see page Select (interactive)).