CREATE TEMP TABLE statement

Use the CREATE TEMP TABLE statement to create a temporary table in the current database.

Syntax

(1)
Element Description Restrictions Syntax
table Name declared here for a table Must be unique in session. See Declaring a name for a temporary table Identifier

Usage

You must have the Connect privilege on the database to create a temporary table. The temporary table is visible only to the user who created it.

If you include the optional IF NOT EXISTS keywords, the database server takes no action (rather than sending an exception to the application) if a temporary table of the specified name already exists in the current session.

You can also define indexes and constraints on temporary tables that you define with the CREATE TEMP TABLE statement.

In DB-Access, using the CREATE TEMP TABLE statement outside the CREATE SCHEMA statement generates warnings if you set DBANSIWARN.

In ESQL/C, the CREATE TEMP TABLE statement generates warnings if you use the -ansi flag or set the DBANSIWARN environment variable.