【发布时间】:2021-03-06 11:40:59
【问题描述】:
我的目标是合并两个 WITH 子句的结果。 下面使用 UNION 的 Code1 按预期工作。但是如果将 WITH 子句用作 code2,则会显示 ORA-32034:不支持使用 WITH 子句。 如何修改code2,合并WITH子句的两个结果?
代码1
select * from
( (select 1 from dual)
union all
(select 2 from dual)
);
代码2
select * from
(
(WITH TEMP AS ( select 1 from dual ) select * from TEMP)
union all
(WITH TEMP AS ( select 2 from dual ) select * from TEMP)
);
【问题讨论】:
-
在 SELECT 语句之前定义 CTE。