Applications often uses some form of temporary data store for processes that are to complicated to complete in a single pass. often, these temporary stores are defined as database tables or PL/SQL tables.
The data in a global temporary table is private, such that inserted by a session can only be accessed by that session. The session-specific rows in a global temporary table can be preserved for the whole session, or just for the current transaction. the ON COMMIT DELETE ROWS clause indicates that the data should be deleted at the end of the transaction.
CREATE GLOBAL TEMPORARY TABLE TEMP_TBL(
COL2 NUMBER) ON COMMIT DELETE ROWS;
In contrast, the ON COMMIT PRESERVE ROWS clause indicates that rows should be preserved until the end of the session.
COL2 NUMBER) ON COMMIT PRESERVE ROWS;
- If the truncate statement is issued against a temporary table, only the session specific data is truncated. there is no affect on the data of other session.
- Data in temporary tables is automatically delete at the end of the session, even if it ends abnormally.
- Indexes can be created on temporary tables. the content of the index and the scope of the index is that same as the database session.
- Views can be created against temporary tables and combinations of temporary and permanent tables.
- Temporary tables can have triggers associated with them.
- Export and import utilities can be used to transfer the table definitions, but no data rows are processed.
- There are a number of restrictions related to temporary tables but these are version specific.