您可以为此使用子查询,如下所示select *from ( select *
from emp
order by sal desc ) where ROWNUM <= 5;更新:为了限制下界和上界的结果,事情会变得更加臃肿。select * from ( select a.*, ROWNUM rnum from
( <your_query_goes_here, with order by> ) a
where ROWNUM <= :MAX_ROW_TO_FETCH )where rnum >= :MIN_ROW_TO_FETCH;更新2:从Oracle 12c(12.1)开始,有一种限制行或以偏移开始的语法。SELECT * FROM sometableORDER BY name
OFFSET 20 ROWS FETCH NEXT 10 ROWS ONLY;