Oracle rownum范围

时间:2018-12-21 10:20:08

标签: sql oracle rownum

如何在rowum范围内从oracle数据库返回数据,这不起作用

select *from(
select * from t where  date>=sysdate-1 order by date desc
) where ROWNUM>=20 and ROWNUM<=40

2 个答案:

答案 0 :(得分:2)

在Oracle 12C +中,您可以使用BigNumber / offset

fetch

答案 1 :(得分:1)

rownum被设置为从查询中输出行,因此您需要将其包括在内联视图中并在视图外应用过滤器:-

select * from (
select *, rownum as r from t where  date>=sysdate-1 order by date desc
) where r>=20 and r<=40