Global Temporary Tables in Oracle

Global Temporary Tables in Oracle,AskHareesh Blog for OracleApps

 

Global Temporary Tables in Oracle

Applications often use 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. In oracle 8i, the maintenance and management of temporary tables can be delegated to the server by using global temporary tables.
Creation of global temporary tables
Miscellaneous features
Creation of global temporary tables
The data in a global temporary table is private, such that data 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 my_temp_table (
Column1 number,
Column2 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.
Create global temporary table my_temp_table (
Column1 number,
Column2 number ) on commit preserve rows;
Miscellaneous features
 * 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 sessions.
Tables.
* temporary tables can have triggers associated with them.
 * export
* data in temporary tables is stored in temp segments in the temp table space.
* data in temporary tables is automatically deleted at the end of the database 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 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.
*/