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