本帖最后由 sky5476 于 2009-11-24 15:02:58 编辑

解决方案 »

  1.   

    关联条件是?create table table3 as select a,b,c,e,f from table1,table2 where ...;
      

  2.   


    我两张表太大了,这样会报错TEMP临时空间不足错误 。临时表空间公司是不让动的,
      

  3.   

    那就先把表3建起来,然后用cursor select 1和2,forall insert 每到一定记录数commit一次。
      

  4.   


    或者这样也行,就是把表TABLE2中的e,f列 复制到表TABLE1 中,得到结果要求是TABLE1(a,b,c,e,f)
      

  5.   

    那就先把表3建起来,然后用cursor select 1和2,forall insert 每到一定记录数commit一次。四楼这个方法可行
      

  6.   

    create table t3 as select a,b,c,e,f from t1,t2 where ... and rownum <= 1;truncate t3;create or replace procedure proc 
    is
       type t_cur is ref cursor;
       insert_cur t_cur;
       type t_rec is table of t3%rowtype index by binary_integer;
       rows_rec t_rec;
    begin
       open insert_cur for select a,b,c,e,f from t1,t2 where ...;
       loop
          fetch insert_cur bulk collect into rows_rec
          limit 1000;
          exit when insert_cur%notfound;
          forall i in rows_rec.first..rows_rec.last
             insert into t3 values rows_rec(i);
          commit;
       end loop;
    end proc;
      

  7.   

    truncate table t3; 下面的过程里面loop结束后关闭cursor