问题描述
大家好,当我以某种方式执行此查询时,它抛出以下错误 -
Hi all when I executed this query somehow its throwing the following error -
ORA-00907:缺少右括号
.
但是如果您从 SELECT 2 FROM DUAL order by 1
中删除 order by 1
其工作.
But if you remove the order by 1
from SELECT 2 FROM DUAL order by 1
its working.
我是否错过了这里的某些东西或它的 ORACLE 限制
Did I miss something out here or its ORACLE limitation
SELECT (CASE
WHEN EXISTS
(SELECT 1 FROM DUAL) THEN
(SELECT 4
FROM dual)
ELSE
(SELECT 2 FROM DUAL order by 1 )
END) AS DELEGATOR FROM dual
下面是一个工作代码,删除了 1 的顺序
Below is a working code with order by 1 removed
SELECT (CASE
WHEN EXISTS
(SELECT 1 FROM DUAL) THEN
(SELECT 4
FROM dual)
ELSE
(SELECT 2 FROM DUAL )
END) AS DELEGATOR FROM dual
推荐答案
不知怎么的我已经放弃了 但是当我把代码改成这样它以某种方式起作用.我申请了我的实际查询和结果是预期的结果.
Somehow I already give up but when I change the code to thisit somehow works. I applied to my actual query and the resultare the expected outcome.
选择(案例何时存在(从双选中选择 1)然后(选择 4从双)别的(select * from (SELECT 2 FROM DUAL order by 1)其中 rownum = 1)完)作为来自双重的委托人
SELECT (CASE WHEN EXISTS (SELECT 1 FROM DUAL) THEN (SELECT 4 FROM dual) ELSE (select * from (SELECT 2 FROM DUAL order by 1 ) where rownum = 1) END) AS DELEGATOR FROM dual
这篇关于Oracle Order by not working for Subquery from DUAL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!