Is there a way to make an Oracle
query behave like it contains a MySQL limit
clause?
In MySQL, I can do this:
select * from sometableorder by namelimit 20,10
to get the 21st to the 30th rows (skip the first 20, give the next 10). The rows are selected after the order by
, so it really starts on the 20th name alphabetically.
In Oracle, the only thing people mention is the rownum
pseudo-column, but it is evaluated beforeorder by
, which means this:
select * from sometablewhere rownum <= 10order by name
will return a random set of ten rows ordered by name, which is not usually what I want. It also doesn't allow for specifying an offset.