orcale 数据库分页

版权声明:https://blog.csdn.net/haochaoguo1988 https://blog.csdn.net/haochaoguo1988/article/details/83107151

 orcale 数据库分页查询 SQL语句写法:推荐第三种

--分页查询一
select *
  from (select a1.*, rownum rn
          from (select * 数据库表名) a1
         where rownum <= 5)
 where rn >= 1;

--分页查询二
select a1.*
  from (select 数据库表名.*, rownum rn from 数据库表名 where rownum <= 5) a1
 where rn >= 1;

--分页查询三
select a1.*
  from (select 数据库表名.*, rownum rn from 数据库表名) a1
 where rn between 1 and 5;
一:
select *
  from (select c.status
          from c_claim_tasks c
         where c.stage = '007')
 where rownum <= 5
   and rownum >= 1;


二:
select *
  from (select c.status
          from c_claim_tasks c
         where stage = '007')
 where rownum between 1 and 5

猜你喜欢

转载自blog.csdn.net/haochaoguo1988/article/details/83107151