ORA-00907:missing right parenthesis缺少右括号
生活随笔
收集整理的這篇文章主要介紹了
ORA-00907:missing right parenthesis缺少右括号
小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
一,有嵌套查詢,并且子查詢中用了union all合并兩個(gè)查詢時(shí),前一個(gè)查詢用了order by,那么會(huì)報(bào)錯(cuò)并提示ORA-00907:missing right parenthesis缺少右括號(hào):
select * from ( select t.* from emp t where t.job='MANAGER' order by t.empno union all select t.* from emp t where t.job='SALESMAN' )不要像上面那樣寫,如果要實(shí)現(xiàn)排序的功能,可以這樣寫:在union all語(yǔ)句的最后面使用order by+數(shù)字(數(shù)字表示排序的字段的索引)
select t.* from emp t where t.job='MANAGER' union all select t.* from emp t where t.job='SALESMAN' order by 1二,使用in的子查詢中用了order by
select t.* from emp t where t.empno in(select t.empno from emp t order by t.empno )正確的寫法是子查詢中去掉order by
?
創(chuàng)作挑戰(zhàn)賽新人創(chuàng)作獎(jiǎng)勵(lì)來(lái)咯,堅(jiān)持創(chuàng)作打卡瓜分現(xiàn)金大獎(jiǎng)總結(jié)
以上是生活随笔為你收集整理的ORA-00907:missing right parenthesis缺少右括号的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: 上证指数30年k线图_技术预判2020:
- 下一篇: 房贷越还越少叫什么