select * from table1
  where rownum <= 1000
其他的可以用游標來做

解决方案 »

  1.   

    选择表中的某一行记录:(理解: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);
      

  2.   

    选记录用rownum就行了,楼上讲的不错
      

  3.   

    1、select * from tab where rownum<1001;
    2、select count(*) from tab;
      

  4.   

    to znbalan 第二条不对吧
      

  5.   

    SELECT *
    FROM t
    SAMPLE (100*1000/50000)