Oracle中的数据分页

来源:互联网 发布:php arraypush 编辑:程序博客网 时间:2024/04/16 13:38
 

 利用ROWNUM 对结果进行分页,下面返回结果中的第6 到第10 条记录:

 

第一种方式
SQL> select * from
  2  (
  3  select a.*, rownum as rn from css_bl_view a
  4  where capture_phone_num = '(1) 925-4604800'
  5  ) b
  6  where b.rn between 6 and 10;
 
6 rows selected. 
  
 
第二种方式

SQL> select * from css_bl_view a
  2  where capture_phone_num = '(1) 925-4604800'
  3  and rownum <= 10
  4  minus
  5  select * from css_bl_view a
  6  where capture_phone_num = '(1) 925-4604800'
  7  and rownum <= 5
  8  ;

 

第三种方式

SQL> select * from
  2  (
  3  select a.*, rownum as rn from css_bl_view a
  4  where capture_phone_num = '(1) 925-4604800'
  5  and rownum <= 10
  6  ) b
  7  where b.rn > 5;

原创粉丝点击