sxw5like

常用链接

统计

最新评论

oracle with用法

with a as (select * from user where username like '张%')
,b as (select * from role where rolename = '03')
,c as (select * from user_to_role  t,a ,b  where t.userid=a.userid and t.roleid=b.roleid)
select a.* from  a


a/b/c用于一个语句中某些中间结果放在临时表空间的SQL语句
临时表是会话结束就自动被PGA清除
都能写,但执行计划不同的。当有多个相似子查询的时候,用with写公共部分,
因为子查询结果在内存临时表中执行效率相对而言比较快。

posted on 2012-04-20 15:58 小文 阅读(127) 评论(0)  编辑  收藏


只有注册用户登录后才能发表评论。


网站导航: