我需要撰寫如下查詢 - 給出的查詢僅用于概念。
我正在獲取子句中使用ORA-00942: table or view does not exist的視圖表。inner_nested_tablewith
首先,這樣使用是否合法?如果沒有,我可以使用任何解決方法。
select
inner_nested_table.column1,
inner_nested_table.column2,
inner_nested_table.column3,
(
with test as (
select
column4, column5
from
inner_nested_table
)
select column4 from test
) columnX
from
(
select
column1,
column2,
column3,
column4,
column5
from
actual_table
) inner_nested_table;
uj5u.com熱心網友回復:
test子查詢嵌套太深,SQL 引擎無法找到inner_nested_table. Oracle 支持查找嵌套在一層但不是兩層的別名。
相反,您可以使用:
WITH inner_nested_table AS (
select column1,
column2,
column3,
column4,
column5
from actual_table
),
test AS (
select column4
from inner_nested_table
)
select column1,
column2,
column3,
(select column4 from test) AS columnX
from inner_nested_table;
db<>在這里擺弄
轉載請註明出處,本文鏈接:https://www.uj5u.com/ruanti/466318.html
