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

时间:2021-12-10 15:46:24

I recently learned about CTE's in SQL Server and am attempting to use it in 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.

我最近在SQL Server中了解了CTE,并尝试在PL / SQL中使用它。我不需要它的反复好处,但是,我想用它来代替创建视图并提高查询性能。只是寻找一些代码可能类似的方向。

1 个解决方案

#1


11  

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”。

#1


11  

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”。