oracle

SQL command not properly ended when using LIMIT


I am executing the below query in SQL Developer.

SELECT * FROM Person where person_name='rahul' order by created_time desc limit 10;

When I execute it, SQL Developer gives me below error.

ORA-00933: SQL command not properly ended
00933. 00000 -  "SQL command not properly ended"
*Cause:    
*Action:

I used the below link for reference.

https://www.techonthenet.com/sql/select_limit.php

I already tried

SELECT * FROM Person where person_name='rahul' order by created_time desc OFFSET 5 ROWS FETCH NEXT 10 ROWS ONLY;

ORA-00933: SQL command not properly ended
00933. 00000 -  "SQL command not properly ended"
*Cause:    
*Action:
Error at Line: 1 Column: 75

Note that OFFSET is not treated as keyword.


Solution

  • I have resolved the issue by using the below query.

    SELECT * FROM Person where person_name='rahul' and rownum between 1 and 2 order by created_time desc;