What is a temporary table for Oracle??

Source: Internet
Author: User

The Oracle database can also create temporary tables in addition to saving permanent tables. A temporary table is a nologging that is stored in a temporary table space and does not log.
1. Temporary tables can create temporary indexes, views, triggers
2. If you want to drop the session-level staging table, and it contains data, you must first truncate the data in it. Otherwise you will get an error.
3. Temporary tables do not have DML locks
4. Temporary tables cannot save data permanently
5. Primary foreign key relationships are not supported
There are two types of temporary tables
1. Session-level staging table
A session-level temporary table is the data in a staging table that exists only during the session lifecycle, and when the user exits the end of the session, Oracle automatically clears the data from the staging table.

Create Global Temporary Table Table_Name(id numbername varchar2(20)...)On Commit Preserve Rows;

2. Transaction-level staging table
A transaction-level temporary table is the data in a temporary table that exists only during the transaction life cycle, and when a transaction ends (commit or rollback), Oracle automatically clears the data in the staging table

Create Global Temporary Table Table_Name(id numbername varchar2(20)...)On Commit Delete Rows;

Note: Although temporary tables automatically purge data after exiting a session or after committing a transaction to roll back a transaction, the structure of the staging table and metadata are also stored in the user's data dictionary. If the staging table completes its mission, it is best to delete the temporary table, otherwise the database will have many table structures and metadata for the temporary table.

What is a temporary table for Oracle??

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.