1.1

Table Of Contents
Syntax
DECLARE GLOBAL TEMPORARY TABLE table-name
{ column-definition [ , column-definition ] * }
[ ON COMMIT {DELETE | PRESERVE} ROWS ]
NOT LOGGED [ON ROLLBACK DELETE ROWS]
Description
The DECLARE GLOBAL TEMPORARY TABLE statement denes a temporary table for the current connection
uniquely identied in the member.
These tables do not reside in the system catalogs and are not persistent. Temporary tables exist only during the
connection that declared them and cannot be referenced outside of that connection. When the connection closes,
the rows of the table are deleted, and the in-memory description of the temporary table is dropped.
Temporary tables are useful when:
The table structure is not known before using an application.
Other users do not need the same table structure.
Data in the temporary table is needed while using the application.
The table can be declared and dropped without holding the locks on the system catalog.
table-name
Names the temporary table. If a schema-Name other than SESSION is specied, an error will occur (SQLSTATE
428EK). If the schema-Name is not specied, SESSION is assigned. Multiple connections within the same JVM
cannot dene declared global temporary tables with the same name, because each connection attempts to create
a local table of the same name, which is not allowed. Multiple active connections across members can create
the table with the same name as temporary tables are process local.
Future versions of SQLFire may support temporary tables with same name over multiple connections in a single
member.
Using SESSION as the schema name of a physical table will not cause an error, but is discouraged. The SESSION
schema name should be reserved for the temporary table schema.
column-definition
See column-denition in CREATE TABLE for more information. DECLARE GLOBAL TEMPORARY TABLE
does not allow generated-column-spec in the column-denition.
Data types
Supported data types are:
BIGINT
CHAR
DATE
DECIMAL
DOUBLE
DOUBLE PRECISION
FLOAT
INTEGER
NUMERIC
REAL
497
SQL Language Reference