您的位置:首页 > 数据库 > Oracle

Oracle的with子句的用法

2009-03-05 17:57 363 查看
用with子句的好处:

使用 WITH 子句, 可以避免在SELECT 语句中重复书写相同的语句块
WITH 子句将该子句中的语句块执行一次并存储到用户的临时表空间中
使用 WITH 子句可以提高查询效率

 

例子:

with
temp_from as (select * from test1),
temp_where as (select testid from test2)
select * from temp_from
where exists (select testid from temp_where where temp_from.testid = temp_where.testid)
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  oracle 存储