This statement can be embedded in an application program or issued interactively. It is an executable statement that can be dynamically prepared.
Your privilege set must include at least one of the following:
You may require additional authorization if you use the LIKE keyword.
Bold text indicates clauses or options that are supported only syntactically.
CREATE GLOBAL TEMPORARY TABLE table-name
(column-spec ,...)
[LIKE {table-name | view-name}]
[CCSID {ASCII | EBCDIC}]
column-spec:
column-name data-type [FOR {BIT | MIXED | SBCS} DATA] [NOT NULL]
table-name | Names the temporary table. The name, including the implicit or explicit qualifier, must not identify a table, view, alias,
synonym, or temporary table that exists at the current server.
In the LIKE clause, table-name specifies that the columns of the table have the exact same name and description as the columns of the identified table. |
view-name | Specifies that the columns of the table have exactly the same name and description as the columns of the identified view. |
column-name | Names the column. The name must not be qualified and must not be the same as the name of another column in the table. |
data-type | Specifies the data type of the column. The types allowed and the rules followed are the same as those for the CREATE TABLE statement. |
Specifies a subtype for a character string column. The subtypes allowed and the rules followed are the same as those for the CREATE TABLE statement.
Specifies the data type of the column. The data type can be a built-in data type or a distinct type.
built-in-data-type | Any built-in data type that can be specified for the CREATE TABLE statement with the exception that you cannot define a temporary table with a LOB or ROWID column. |
distinct-type | Any distinct type except one that is based on a LOB or ROWID data type. The privilege set must implicitly or explicitly include the USAGE privilege on the distinct type. |
Specifies that the column cannot contain nulls. Omission of NOT NULL indicates that the column can contain nulls.
Specifies that the columns of the table have exactly the same name and description as the columns of the identified table or view. The name specified after LIKE must identify a table, view, or temporary table that exists at the current server. The privilege set must implicitly or explicitly include the SELECT privilege on the identified table or view.
This clause is similar to the LIKE clause on CREATE TABLE, but it has the following differences: