Oracle syntax error [duplicate]

爱⌒轻易说出口 提交于 2019-12-01 15:33:14

问题


I got the following error in Oracle:

SELECT * FROM abcd WHERE name LIKE 'a%' LIMIT 10
                                        *
ERROR at line 1:
ORA-00933: SQL command not properly ended

What is the problem with the command?


回答1:


Oracle doesn't support the limit clause. That's a MySQL/Postgres thing.

There are alternatives, although they're often a lot more involved

http://www.oracle.com/technology/oramag/oracle/06-sep/o56asktom.html

The simplest equivalent is:

select * from abcd where name like 'a%' and ROWNUM <= 10;


来源:https://stackoverflow.com/questions/2354616/oracle-syntax-error

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!