Andrey.Kyurkchiev Andrey.Kyurkchiev - 5 months ago 58
SQL Question

Oracle SQL Developer 11g OFFSET FETCH gives error

I am making a query and trying to fetch a random number of rows from a database but Oracle keeps telling me my command has not been ended properly.

select *
from random_table
order by random_column_name
offset 0 rows
fetch first 10 rows only


This is the code I'm using.

I would greatly appreciate any support since I've spent quite some time searching for an explanation for the outcome I'm getting, but to no avail.

Answer

That syntax isn't valid until Oracle Database 12c.

You would say instead

select *
from random_table
order by random_col
where rownum < 11