The Oracle RDBMS CREATE GLOBAL TEMPORARY TABLE statement create a temporary table.
This tables are useful in applications where a result set is to be buffered.
The general format is:
CREATE GLOBAL TEMPORARY TABLE temptablename (
column datatype [DEFAULT expr] [column_constraint(s)]
[,column datatype [,...]]
) {ON COMMIT DELETE ROWS | ON COMMIT PRESERVE ROWS};
ON COMMIT DELETE ROWS creates a temporary table that is transaction specific. The database delete all rows (truncate) after each commit.
ON COMMIT PRESERVE ROWS creates a temporary table that is session specific. The database delete all rows (truncate) when you terminate the session.
Example 1:
CREATE GLOBAL TEMPORARY TABLE invoicetmp
(invdate DATE,
desc VARCHAR2(20))
ON COMMIT DELETE ROWS;