Oracle 临时表 sql 简单的应用

Oracle临时表的创建有以下两种:
(1)会话特有的临时表
create global temporany table 表名(
字段名 数据类型,字段名 数据类型,......)
on commit preserve rows;
例:
create global temporany table test1(
user_cd varchar(32),user_name varchar(100),job_date date)
on commit preserve rows;
(2)事务特有的临时表
create global temporany table 表名(
字段名 数据类型,字段名 数据类型,......)
on commit delete rows;
例:
create global temporany table test1(
user_cd varchar(32),user_name varchar(100),job_date date)
on commit delete rows;

创建后就可以插入数据了。

两种临时表的不同在于:
事务特有的临时表在commit后会清空所有行;会话特有的临时表在commit后不会清空数据,而是在会话结束后清空数据。

posted @ 2020-03-16 10:54  想做架子工的攻城狮  阅读(246)  评论(0编辑  收藏  举报