1-- Oracle <= 11g
2SELECT * FROM ( SELECT * FROM emp ORDER BY sal DESC ) WHERE ROWNUM <= 5;
3
4-- Oracle 12c +
5SELECT * FROM emp ORDER BY sal DESC FETCH FIRST 5 ROWS ONLY;
1SELECT *
2FROM sometable
3ORDER BY name
4OFFSET 20 ROWS FETCH NEXT 10 ROWS ONLY;
1SELECT *
2FROM sometable
3ORDER BY name
4OFFSET 20 ROWS FETCH NEXT 10 ROWS ONLY;
5