请问各位高手,怎么样用oracle实现分页显示

flydragon 2000-08-31 03:07:00
我用的是linux+apache+php4+oracle816
请问各位高手怎么实现分页显示???
请详细说明
本人是一菜鸟级人物!
谢谢!!
...全文
248 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
zdg 2000-10-25
  • 打赏
  • 举报
回复
代cxgTommy回答:
-----------------------------------------------------------------------
单用数据库也行,有个用过的办法,有问题,但是还可以顶一下
select * from table,(
select primarykey from (select primarykey,rownum id1 from table where rownum<n*20) where id1>(n-1)*20) tableres
where table.primarykey=tableres.primarykey
所谓的问题就是oracle不能在子查询里面排序,有些功能这种方法就无法
实现了,如果哪位大虾有改进办法或更好的办法,请告知。
:)
oicq: 1766598
email: cxgtommy@sina.com
Tommy Chang 2000-10-25
  • 打赏
  • 举报
回复
单用数据库也行
有个用过的办法,有问题,但是还可以顶一下
select * from table,(
select primarykey from (select primarykey,rownum id1 from table where rownum<n*20) where id1>(n-1)*20) tableres
where table.primarykey=tableres.primarykey

所谓的问题就是oracle不能在子查询里面排序,有些功能这种方法就无法实现了,如果哪位大虾有改进办法或更好的办法,请告知。

:)
oicq: 1766598
mail: cxgtommy@sina.com
Tommy Chang 2000-10-24
  • 打赏
  • 举报
回复
单用数据库也行
有个用过的办法,有问题,但是还可以顶一下
select * from table,(
select primarykey from (select primarykey,rownum id1 from table where rownum<n*20) where id1>(n-1)*20) tableres
where table.primarykey=tableres.primarykey

所谓的问题就是oracle不能在子查询里面排序,有些功能这种方法就无法实现了,如果哪位大虾有改进办法或更好的办法,请告知。

:)
flyby 2000-10-24
  • 打赏
  • 举报
回复
定义变量 total:记录总数 ,Pnum:每页记录数,page:页码(初始值为1)。
假设total=100,pnum=10
当前要显示的第3页(page=3)的记录(21-30):sql语句可以这样写:
select * from table where Rownum<page*pnum;
minus//除去
select * from table where Rownum<(page-1)*pnum;
注意:
不能写成:
select * from table where Rownum>(page-1)*pnum and Rownum<page*pnum;
heshengjie 2000-10-20
  • 打赏
  • 举报
回复
关注
王释之 2000-08-31
  • 打赏
  • 举报
回复
只涉及到编程,不关数据库,只要纪录达到分页条件.
分页比较简单,看一看人家的程序?
wwwunix 2000-08-31
  • 打赏
  • 举报
回复
在php4中实现。

34,576

社区成员

发帖
与我相关
我的任务
社区描述
MS-SQL Server相关内容讨论专区
社区管理员
  • 基础类社区
  • 二月十六
  • 卖水果的net
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧