简体   繁体   English

PL / SQL中是否存在公用表表达式?

[英]Does something like Common Table Expressions exist in PL/SQL?

I recently learned about CTE's in SQL Server and am attempting to use it in PL/SQL. 我最近在SQL Server中了解了CTE,并尝试在PL / SQL中使用它。 I do not need the recurive benefits of it, however, I would like to use it in lieu of creating a view and to improve query performance. 我不需要它的反复好处,但是,我想用它来代替创建视图并提高查询性能。 Just looking for some direction on what code may be similar. 只是寻找一些代码可能类似的方向。

In Oracle this is known as subquery factoring, and it works the same as in SQL Server AFAIK: 在Oracle中,这称为子查询因子,它与SQL Server AFAIK中的相同:

with cte as (select * from emp)
select * from cte join dept on dept.deptno = cte.deptno;

See SELECT documentation and search for "factoring". 请参阅SELECT文档并搜索“factoring”。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM