当前位置:Gxlcms > 数据库问题 > oracle 两个sql带有order by的使用union/union all的时候报错 'ORA-00933:sql命令未正确结束' 处理办法

oracle 两个sql带有order by的使用union/union all的时候报错 'ORA-00933:sql命令未正确结束' 处理办法

时间:2021-07-01 10:21:17 帮助过:5人阅读

错误语句:select id,name from s1 order by stime union all select id,name from s2 order by stime 

报错原因:oracle 搜索到order by后认为整个select语句就该结束了但是后面还有union all所以数据库无法解析,导致报错

处理办法:with a1 as (select id,name from s1 order by stime) , a2 as (select id,name from s2 order by stime)  select * from a1 union all select * from a2

oracle 两个sql带有order by的使用union/union all的时候报错 'ORA-00933:sql命令未正确结束' 处理办法

标签:sele   select   nbsp   数据   ora   原因   无法解析   搜索   语句   

人气教程排行