oracle分页查询语句

使用rownum分页查询

select * from (select t.*,rownum rn from (select b.name,b.age from tb_user b)t where rownum <=pageIndex * pageSize)where rn>(pageIndex -1)* pageSize

注意:pageIndex是分页查询下标,pageSize是分页查询大小。如查询第一页,每页大小为500的sql为

select * from (select t.*,rownum rn from (select b.name,b.age from tb_user b)t where rownum <=1 * 500)where rn>(1 -1)* 500

你可能感兴趣的:(oracle,数据库,分页查询)