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