SQL*Plus

Demonstrate Oracle 8i temporary tables

OEasy 2006. 12. 26. 15:15
rem -----------------------------------------------------------------------
rem Filename:   temptab.sql
rem Purpose:    Demonstrate Oracle 8i temporary tables
rem Date:       23-Apr-2000
rem Author:     Frank Naude, Oracle FAQ
rem -----------------------------------------------------------------------
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;