gpt4 book ai didi

sql - 我可以在 Oracle SQL 中嵌套 "WITH"子句吗?

转载 作者:行者123 更新时间:2023-12-04 21:24:18 25 4
gpt4 key购买 nike

以下查询给了我一个错误:

"ORA-32034: Unsupported use of WITH clause"


 WITH table_B as 
(
SELECT * FROM (
WITH table_A AS
(SELECT 'Akshay' as NAME FROM DUAL)
SELECT NAME FROM table_A
) WHERE NAME LIKE '%Aks%' ---<<< Note a filter here
)
SELECT * from table_B;

有出路吗?谢谢

最佳答案

您应该将查询更改为:

WITH table_a AS
(
SELECT 'Akshay' as name
FROM dual
)
,table_b AS
(
SELECT name
FROM table_a
WHERE name LIKE '%Aks%'
)
SELECT *
FROM table_b;

关于sql - 我可以在 Oracle SQL 中嵌套 "WITH"子句吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41604201/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com