CREATE TEMP TABLE statement

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

Syntax

(explicit id ctt001a) ctt001a (explicit id ctt02a) ctt02a (explicit id ctt003a) ctt003a (explicit id ctt04a) ctt04a (explicit id ctt05a) ctt05a (explicit id ctt06a) ctt06a CREATE TEMP TABLE [IF NOT EXISTS] table( <Column Definition>[] [ , { { <Multiple-Column Constraint Format> [] <Column Definition> [] } } ] ) [ WITH NO LOG ] [ [] <Storage Options>[] ] [ <LOCK MODE Options> [] ] [ <USING Access-Method Clause> [] ]
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.

2 Informix® extension