oracle臨時表with oracle with as區(qū)別和用法?
oracle with as區(qū)別和用法?With as 就是將一個子查詢的結(jié)果作為一張臨時表,下面接著寫select語句可以通過別名直接使用語法:針對一個別名with tmp as (select
oracle with as區(qū)別和用法?
With as 就是將一個子查詢的結(jié)果作為一張臨時表,下面接著寫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),
…
例子:
--相當于建了個e臨時表
with e as (select * from scott.emp e where e.empno=7499)
select * from e
--相當于建了e、d臨時表
with
e as (select * from scott.emp),
d as (select * from scott.dept)
select * from e, d where e.deptno = d.deptno