Go Oracle Temporary table usage

Source: Internet
Author: User

This article was reproduced from: http://www.iteye.com/topic/371390

Oracle's temporal tables play a big role in the application system, which allows users to manipulate their own data without interfering with each other, without worrying about damaging or affecting other session/transaction data, which is a solution to data security.
Temporary table is divided into two kinds of session, transaction, session-level temporal table data throughout the session, until the end of the session, and the transaction level of temporary table data at the end of the tranaction disappear, The Commit/rollback or end session clears the Tranaction temporary table data.
Syntax for two temporary tables:
Create global temporary table name on commit preserve|delete rows using Preserve is a session-level temporal table, with delete being the transaction level temporary table

One, session level temporary table
1. Create a temporary table

    Create Temporary Table varchar2 ())        on Commit Preserve rows  

2. Inserting data

    Insert  into Values ('test session table')  

3. Commit commits;
4. Query data

    Select *  from Temp_tbl  

You can see that the data ' test session table ' record is still in.
End session, login again, query data Select *from TEMP_TBL, this time the record does not exist because the system automatically clears the record when the session is closed
Second, transaction level temporary table
1. Create a temporary table

    Create Temporary Table varchar2 ())        on Commit Delete rows  

2. Inserting data

    Insert  into Values ('test Transaction table')  

3. Submit
Commit
4. Query data

    Select *  from Temp_tbl  

At this point, you can see that the record you just inserted ' Test transaction table ' no longer exists; again, if you do not commit and end the session directly, no re-login record

Go Oracle Temporary table usage

Related Article

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.