select * from applytbl where rownum < 20;
我用这个可以返回数据可是
select * from applytbl where rownum > 20;
得不到任何数据啊

解决方案 »

  1.   

    select * from (
    select rownum id ,a.* from tbname a
    where rownum<200)
    where id>100;
      

  2.   

    rownum似乎只能记前面的N条记录
      

  3.   

    rownum是一个伪列,oracle认为任何大于rownum>N的条件都是不存在的,只能取rownum<=N
    选择表中的某一行记录:(理解:rownum是oracle系统顺序分配为从查询返回的行的编号)
    select * from (select rownum a,t.* from testtab t) where a=2;
    select * from (select rownum a,t.* from testtab t) where a=3;
    select * from (select rownum a,t.* from testtab t) where a=4;
       不能为:
    select * from (select rownum,t.* from testtab t) where rownum=2;或
    select * from testtab where rownum=2;
       返回多行记录:
    select * from testtab where rownum<=10;
       返回某段记录:(如取记录表中4-10行)
    select * from (select rownum no,testtab.* from testtab where rownum<=10) where no>=4;
       不能为:
    select * from tsettab where rownum>10;
       返回最后一行记录:
    select * from (select rownum a,t.* from testtab t) where a=(select count(*) from testtab);