码迷,mamicode.com
首页 > 数据库 > 详细

使用Oracle基于session的临时表要注意的问题

时间:2014-10-15 23:08:11      阅读:457      评论:0      收藏:0      [点我收藏+]

标签:style   blog   color   io   使用   ar   sp   数据   on   

   在Oracle中有两种临时表,一种是基于session,就是当出现commit之后,数据就会被清空;一种是基于session,当session断开后,数据会被清空。

--基于事务的临时表

create global temporary table test
(
  ID   number
)
on commit delete rows;


--基于session的临时表
create global temporary table test
(
  ID   number
)

on commit preserve rows;

   如果你的系统架构是三次架构,有连接池概念的,如  weblogic+oracle这种架构,其实session是不会退出的,只是请求完毕后,将session还给连接池。如果你操作基于session的临时表,每次操作完表后不做删除操作。那数据会一直累积。最好的做法是使用完以后truncate,今天在测试环境上使用系统测试发现的问题。

使用Oracle基于session的临时表要注意的问题

标签:style   blog   color   io   使用   ar   sp   数据   on   

原文地址:http://blog.csdn.net/stevendbaguo/article/details/40117445

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!