数据库
首页 > 数据库> > ORACLE创建临时事务表global temporary table 和 查询时临时表with tempName as (select ) select

ORACLE创建临时事务表global temporary table 和 查询时临时表with tempName as (select ) select

作者:互联网

创建临时事务表只是保存当前会话(session)用到的数据,数据只在事务或会话期间存在,可规避多线程调用数据冲突问题 
-- Create table create global temporary table TEM_FI_COURSE_CONFIG ( lgart VARCHAR2(20), komok VARCHAR2(20), sign VARCHAR2(20), lgart1 VARCHAR2(20), sign1 VARCHAR2(20), ktosl VARCHAR2(20), bschs VARCHAR2(20), bschh VARCHAR2(20), konts VARCHAR2(20), konth VARCHAR2(20), neg_postng VARCHAR2(20), col01 VARCHAR2(20), neg_postng_deb VARCHAR2(20), symko VARCHAR2(20) ) on commit delete rows;

查询时临时表with tempName as (select ) select

 with as 相当于虚拟视图。

  with as短语,也叫做子查询部分(subquery factoring),可以让你做很多事情,定义一个sql片断,该sql片断会被整个sql语句所用到

  

with tempName as (select ....)
select ...

--针对一个别名
with tmp as (select * from tb_name)

--针对多个别名
with
   tmp as (select * from tb_name),
   tmp2 as (select * from tb_name2),
   tmp3 as (select * from tb_name3),
   …

 

 

   

 

标签:20,临时,VARCHAR2,table,temporary,tb,select,tempName
来源: https://www.cnblogs.com/gongshun/p/10623186.html