Global temporary tables

Source: Internet
Author: User

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. from Oracle 8i or later, the maintenance and management of temporary tables can be delegated to the server by using global temporary tables.

    • Creation of temporary Global 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. theOn commit Delete rowsClause indicates that the data shocould 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,On commit preserve rowsClause indicates that rows shocould 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 trucated. There is no affect on the data of other sessions.
  • Data in temporary tables is automatically delete 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 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.

For more information see:

    • Temporary tables
    • Create Table-global temporary

This post is original fromHttp://www.oracle-base.com/articles/8i/TemporaryTables.php.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.