我问过我们这里的一个ocp,同样的问题,oracle数据库中好像也只能这样作了要不就在视图里引用带游标的函数来解决咯

解决方案 »

  1.   

    select * from table_name where rownum<10001
    select * from table_name where rownum<20001
    minus
    select * from table_name where rownum<10001
      

  2.   

    select * from (select rownum r, t.* from Tablename t where rownum <=n) t1 where t1.r > m and t1.r <= nselect * from (select rownum r, t.* from DBTEST t where rownum<=20000) ss where ss.r > 10000 and ss.r <= 20000
      

  3.   

    用嵌入式sql很容易实现,不过要用c/c++来做了
      

  4.   

    sunnyxp163(sunny)的方法就不错啦
      

  5.   

    做一个过程作分批处理,输一个参数以控制一次查询的数目.
    create procedure pro(p_number in number,p_rc out pack_age.mycursor)
    as
    str varchar2(100);
    begin
    str:='select * from table_name where rownum<='||p_number;
    open p_rc for str;
    end;
    /
      

  6.   

    有一个分区的东西,好象可以一部分一部分读。
    例如:
    create table abc (a1 number,b1,varchar2(10)) partition by range(a1) (partition g1 less than 10001,oartition g2 less than 20002);
    select * from abc partition g1;
    select * from abc partition g2;
      

  7.   

    读取M..N条记录:
    select * from (select * from(select rownum rn,a.* from table_name a) where rownum<N+1) where rn>M-1;
    你的问题可以改为
    select * from (select * from(select rownum rn,a.* from table_name a) where rownum<N*10000+1)  where rn>N*10000-1;
    N:1,2,3...为自然数(可以理解为页数,每页10000条记录)
      

  8.   

    谢谢!谢谢你们!小弟明白了,我会给你们加分的。
    我在麻烦你们大家一下。
    我每次取出一万条记录,然后用writefile()方法写入文件。
    但是现在有40万条记录,也许更多,不知道有多少条,应该怎么处理?
    我应该怎么操作,用一个循环?还是用别的方法?
    谢谢!
      

  9.   

    select * from table_name where rownum<10001