6.2. Temporary table--oracle Mode object

Source: Internet
Author: User

Features of temporary tables:

(1). Oracle allocates storage space for users only when they add data to the table.

(2). allocate space for temporary tables from temporary table spaces , avoiding storage space with data from persistent objects;

(3). the storage space occupied by the temporary table is freed as the transaction ends or the session terminates , and the data is lost;

(4). As with heap tables, you can create indexes, views, triggers , and so on on temporary tables .

Transaction Level temp Table:

-- Create transaction Temp table user_trans

Create Temporary Table User_trans (  number,  varchar2(ten),    VARCHAR2(2),  oncommitdeleterows;

-- inserting a record data

Insert  into Values (1,'tyou',' male ', to_date ('  1988-09-15','yyyy-mm-dd'));

-- query verifies that records exist

SELECT * from User_trans;

-- COMMIT TRANSACTION Operations

Commit

-- re-query to see if the data exists

SELECT * from User_trans;

-- view created temporary table space also exists not

Session-Level staging table:

-- Create session temp table user_sess

Create Temporary Table user_sess (  number,  varchar2(ten),    VARCHAR2(2),  oncommitpreserverows;

-- inserting a record data

Insert  into Values (2,'thm',' female ', to_date ('  1988-09-15','yyyy-mm-dd'));

--query verifies that records exist

SELECT * from User_sess;

--Disconnect the current connection session

Disc

--Re-create the connection session, and then query to see if the data exists

6.2. Temporary table--oracle Mode object

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.