如何把一张几千万数据表的数据按每10万一次移至另外一张表,有什么好的办法

解决方案 »

  1.   

    nCount number;
    nCount := 0;
    loop
    select count(*) into nCount from table1 
    where rownum < 100000;
    --判断循环退出
    if nCount == 0 then
       exit loop;
    end if;
    --插入100000条
    insert into table2
    select * from table1 
    where rownum < 100000;
    --提交
    commit;
    end loop;
      

  2.   

    参考:
    create table  NewBackTable as select * from Oldtable
      

  3.   

    如果表里的数据在你操作期间不不变化的话。可以自己写个存储过程,order by rowid,循环处理。