临时表分为事务级别和会话级别的两种 ###事务级别
语句:on commit delete rows
e.g
create global temporary table tm on commit delete rows
as select * from src where 1=2
事务临时表范围是事务级别的,也就是说,在comint/rollback执行之前,临时表的数据是一直存在的。 ###会话级别
语句:on commit preserve rows
e.g
create global temporary table tm on commit preserve rows
as select * from src where 1=2
会话级别的临时表数据只有当前的会话能操作,其他会话是不能看到这些数据的,临时表的数据只有在此会话断开连接后,数据清零,否则临时表数据一直存在。