https://www.cnblogs.com/wpcnblog/p/3951507.html
1、SESSION级临时表
1、建立临时表
create global temporary table temp_tbl(col_a varchar2(30))
on commit preserve rows
2、插入数据
insert into temp_tbl values('test session table')
3、提交
commit
4、查询数据
select *from temp_tbl
可以看到数据'test session table'记录还在。 结束SESSION,重新登录,再查询数据select *from temp_tbl,这时候记录已不存在,因为系统在结束SESSION时自动清除记录。
2、TRANSACTION级临时表
1、建立临时表
create global temporary table temp_tbl(col_a varchar2(30))
on commit delete rows
2、插入数据
insert into temp_tbl values('test transaction table')
3、提交
commit
4、查询数据
select *from temp_tbl
这时候可以看到刚才插入的记录'test transaction table'已不存在了;同样,如果不提交而直接结束SESSION,重新登录记录也不存在