临时表
在 oracle 中,临时表与普通数据表一样只需要一次创建,其结构从创建
到删除的整个期间都是有效的。相对于其它类型的表,临时表只有在用户
实际向表中添加数据时,才会为其为配存储空间,并且分配的空间来自临
时表空间(temp),这就避免了与永久的数据争用存储空间。
创建临时表,需要使用 create global temporary table 语句,临时表中数据
的保存时间可以通过 on commit 子句来控制,语法如下:
create global temporary table tablename
(
column_name data_type,…
)
on commit delete|preserve rows
在创建临时表时,如果不指定 on commit 子句,则创建的临时表默认为
事务级别的临时表。