The simplified syntax for the CREATE TABLE statement is as follows:
CREATE [GLOBAL TEMPORARY] TABLE table_name (
column_name type [CONSTRAINT constraint_def DEFAULT default_exp]
[, column_name type [CONSTRAINT constraint_def DEFAULT default_exp]...]
)
[ON COMMIT {DELETE | PRESERVE} ROWS]
TABLESPACE table_space;
where
- GLOBAL TEMPORARY specifies that the table's rows are temporary and such tables are known as temporary tables.
- The duration of the contents are specified by the ON COMMIT clause.
- A temporary table is visible to all sessions, but rows are specific to a session.
- type specifies the type of a column.
- constraint_def specifies the definition of a constraint on a column.
- default_exp specifies the expression used to assign a default value to a column.
- ON COMMIT controls the duration of the rows in a temporary table.
- DELETE specifies the rows are deleted at the end of a transaction.
- PRESERVE specifies the rows are deleted at the end of a session.
- If you omit ON COMMIT for a temporary table, the default is DELETE.