ITPub博客

首页 > 数据库 > 数据库开发技术 > how tom write pagenation sql

how tom write pagenation sql

原创 数据库开发技术 作者:jametong 时间:2005-04-27 00:58:48 0 删除 编辑
http://asktom.oracle.com/pls/ask/f?p=4950:8:::::F4950_P8_DISPLAYID:25685777038588
in general your query won't get the "next n rows".

Why would you not just:


select /*+ FIRST_ROWS */ *
from ( select /*+ FIRST_ROWS */ a.*, rownum rnum
from (select /*+ FIRST_ROWS */ * from t where .... order by ... ) a
where rownum <= :MAX_ROW )
where rnum >= :MIN_ROW;


done. that is how I write all pagination queries.


(you do know that A||B has serious programming issues -- A=1, B=11 vs A=11, B=1
-- you need to encode the fields very very carefully. don't go there, really
bad, confusing idea.
[@more@]

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/94317/viewspace-796992/,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2013-11-23

  • 博文量
    47
  • 访问量
    280601