Saturday, 28 April 2012

Demonstrate Oracle temporary tables


drop table x
------------------------- 
create global temporary table x (a date)
        on commit delete rows     -- Delete rows after commit
        -- on commit preserve rows   -- Delete rows after exit session
------------------------- 
select table_name, temporary, duration
from   user_tables
where  table_name = 'X'
--------------------------
insert into x values (sysdate);
 
select * from x;
 
commit;
 
-- Inserted rows are missing after commit
select * from x;

No comments:

Post a Comment