我正在执行以下查询:
explain plan for
with Foo
as (
select * from my_table
)
select * from Foo
where x = 7;
这会导致Oracle10g 中出现无效SQL 语句异常。如果没有解释计划,with 语句将正确执行。为什么在 SQL Developer 的上下文中会出现此错误?
我正在执行以下查询:
explain plan for
with Foo
as (
select * from my_table
)
select * from Foo
where x = 7;
这会导致Oracle10g 中出现无效SQL 语句异常。如果没有解释计划,with 语句将正确执行。为什么在 SQL Developer 的上下文中会出现此错误?
你有一个额外的括号:
explain plan for
with Foo
as (
select * from my_table) -- < remove this
)
select * from Foo
where x = 7;
不确定这种细微差别,但还有另一种写法可以解释。
Select *
From (
Select * From my_table
) Foo
Where Foo.x = 7;
我远离子句,因为它们不能很好地移植,并且根据我的经验,优化器并没有对子句进行动态评估,但这些都是较早的经验。