会话
create global temporary table session_temp_tab on commit preserve rows as select * from dba_users where 1=2;
事务
create global temporary table transaction_temp_tab on commit delete rows as select * from dba_users where 1=2;
select count(1) from session_temp_tab;
select count(1) from transaction_temp_tab;
insert into session_temp_tab select * from dba_users;
insert into transaction_temp_tab select * from dba_users;
select count(1) from session_temp_tab;
select count(1) from transaction_temp_tab;
commmit;
select count(1) from session_temp_tab;
select count(1) from transaction_temp_tab;
当commit之后事务级临时表中的数据自动清除,所以再次查询的时候得到结果为0 !!!
disconnnect;
exit;
dba
select count(1) from session_temp_tab;
当断开之后重新连接之后,会话级临时表中的数据也被自动删除了!!!