从许多行获取行 N 到 M(在 Oracle 12c 之前)

使用分析函数 row_number()

with t as (
  select col1
  , col2
  , row_number() over (order by col1, col2) rn
  from table
)
select col1
, col2
from t
where rn between N and M; -- N and M are both inclusive

Oracle 12c 使用 OFFSETFETCH 可以更轻松地处理这个问题。