当前位置:网站首页>Oracle临时表详解
Oracle临时表详解
2022-07-01 00:32:00 【浅殇忆流年】
一、Oracle 临时表
临时表是一种特殊的表。当我们需要对某一(也可以是多个)表中的一批数据进行反复的操作时,通过对这批数据创建一个临时表,可能会简化操作并且有可能提高效率!
基本语法:
create global temporary table 临时表名(
colum,colum,.......
)
on commit delete rows;
on commit preserve rows;
说明:
- on commit delete rows; 说明数据行只有在当前事务中可见,也是默认值,事务提交后数据行将消失;创建的是事务级临时表。
- on commit preserve rows; 说明数据行仅在当前会话中可见;创建的是会话级临时表。
二、示例演示
2.1、事务级临时表
-- 创建事务级临时表 tmp_user 注:on commit delete rows 可省略
create global temporary table tmp_user (
user_id varchar2(10),
user_name varchar2(20)
) on commit delete rows;


2.2、会话级临时表
-- 创建会话级临时表 tmp_user1
create global temporary table tmp_user1 (
user_id varchar2(10),
user_name varchar2(20)
)on commit preserve rows;


三、临时表说明
- 临时表的数据是基于一个会话或一个事务的,其它的会话不能访问到。
- 临时表可专用于事务处理,也可专用于会话。对于专用于事务处理的临时表而言,数据存在于事务处理期间;对于专用于会话的临时表而言,数据存在于会话期间。在这两种情况下,会话插入的数据专用于会话。每个会话仅可查看和修改自己的数据。因此,临时表的数据从不会获得 DML 锁

边栏推荐
- 1175. Disposition des nombres premiers / échange de doigts II 104. Nombre de permutations
- Wechat official account development (1) introduction to wechat official account
- The programmer's girlfriend gave me a fatigue driving test
- $watch will not trigger data change - $watch not firing on data change
- The programmer's girlfriend gave me a fatigue driving test
- lvm-snapshot:基于LVM快照的备份
- 2022-2028 global single travel industry research and trend analysis report
- IFLYTEK active competition summary! (12)
- What does it mean to open an account online? Is it safe to open an account online?
- Can SQL execution be written in tidb dashboard
猜你喜欢

20220216 misc buuctf another world WinHex, ASCII conversion flag zip file extraction and repair if you give me three days of brightness zip to rar, Morse code waveform conversion mysterious tornado br

Line number of Jenkins pipeline script execution exception

深入理解 Jetpack Compose 内核:SlotTable 系统

Redis - cache penetration, cache breakdown, cache avalanche

Solving the weird problem that the query conditions affect the value of query fields in MySQL query

BeanUtils. Copyproperties() vs. mapstruct

Redis - sentinel mode

Wechat official account development (1) introduction to wechat official account

Vulnerability discovery - App application vulnerability probe type utilization and repair

Analysis of 8253a register
随机推荐
Summer Challenge [FFH] harmonyos mobile phone remote control Dayu development board camera
What is SRM system and how to standardize the internal procurement process of the company
"Experience" my understanding of user growth "new users"
Never use redis expired monitoring to implement scheduled tasks!
C /platform:anycpu32bitpererrored can only be used with /t:exe, /t:winexe and /t:appcontainerexe
Solutions to errors in installing OpenSSL for CentOS 6.3 x64 PHP 5.2.6 extensions
Manage edge browser settings (ie mode, homepage binding, etc.) through group policy in the enterprise
Analysis of 8253a register
C# /platform:anycpu32bitpreferred 只能与 /t:exe、/t:winexe 和 /t:appcontainerexe 一起使用
Basic data structure of redis
Design e-commerce seckill system
在指南针上买基金安全吗?
2022-06-30: what does the following golang code output? A:0; B:2; C: Running error. package main import “fmt“ func main()
2022-2028 global capsule shell industry research and trend analysis report
2022-2028 global ultra high purity electrolytic iron powder industry research and trend analysis report
什么是SRM系统,如何规范公司内部采购流程
VR panorama adds contrast function to make the display of differentiation effect more intuitive!
Why did kubernetes win? The changes in the container circle!
[DaVinci developer topic] -37- detail IRV: introduction to inter runnable variable + configuration
Unit test concept and purpose