oracle 使用union提示ORA-00907:缺少右括号

在使用union的时候提示:ORA-00907:缺少右括号

此原因是因为在union的左边和右边都有order by,因此需要去掉一边的order by,保留一个即可。

例如:

select * from 

(

 select id,name from emp

order by name

union

 select id,name from emp


)

或者:

 

select * from 

(

 select id,name from emp


union

 select id,name from emp


order by name

oracle 使用union提示ORA-00907:缺少右括号

上一篇:数据库脱敏查询


下一篇:TiDB-change data capture