Reputation: 37
I want to ask some records from an ordered table.
select * from table_name order by something desc limit 4;
This is the error message (is the 'limit 4' line):
ORA-00933: SQL command not properly ended
00933. 00000 - "SQL command not properly ended"
*Cause:
*Action:
Error at Line: 7 Column: 1
Upvotes: 2
Views: 203
Reputation: 13484
use ROWNUM
to limit the number of rows returned by a query
http://docs.oracle.com/cd/B28359_01/server.111/b28286/pseudocolumns009.htm#SQLRF00255
select *
(SELECT * FROM table_name ORDER BY someval desc)
WHERE ROWNUM < 5;
Upvotes: 2