zoukankan      html  css  js  c++  java
  • oracle实现"limit"功能

    转载于http://blog.sina.com.cn/s/blog_67e2758d0100s3oc.html

    oracle数据库不支持mysql中limit功能,但可以通过rownum来限制返回的结果集的行数,rownum并不是用户添加的字段,而是oracle系统自动添加的。

    (1)使查询结果最多返回前10行:

    select * from OB_CALL_DATA_LOG where rownum<=10;  (亲测ok)

    select * from (select ncallernm, count(*) tol from tmp_86 group by ncallernm order by tol desc) where rownum<20

    上面语句不用子查询怎么写??

    (2)使查询结果返回中间的10到100行:

    如:select * from OB_CALL_DATA_LOG rownum<101  minus  select * from OB_CALL_DATA_LOG rownum>9

    注:select * from OB_CALL_DATA_LOG    and rownum>99 and rownum<101是错误的,oracle会认为条件不成立

  • 相关阅读:
    POJ 3071 概率DP
    BZOJ 2427 /HAOI 2010 软件安装 tarjan缩点+树形DP
    POJ 1155 树形DP
    POJ 3252 组合数学?
    POJ 3641 快速幂
    POJ 3180 Tarjan
    POJ 3185 DFS
    POJ 3260 DP
    POJ 2392 DP
    99. Recover Binary Search Tree
  • 原文地址:https://www.cnblogs.com/daduryi/p/6825035.html
Copyright © 2011-2022 走看看