第一种吧,truncate b的时间基本可以忽略不计。
insert into的话。定时commit或加append速度应该也很快的。
第二种,如果你需要更新的或插入的数据量较少的话,也可以考虑这种方法。
第三种没必要了。
其实可以使用merg into

解决方案 »

  1.   

    create or replace procedure sp_rpt_update
    is
    cursor c1 is select id ,phone,condition from B@dblink;
    v_id A.id%type;
    v_phone A.phone%type;
    v_condition  A.condition%type;
    v1 number;
    begin
    open c1;
    loop
    fetch c1 into v_id,v_phone,v_condition;
    exit when c1%notfound;
    begin
    select 1 into v1 from A where id=v_id;
    if v1=1 then
    update A set conditon=v_condition,phone=v_phone;end if;
    exception
    when others then
    insert into A values(v_id,v_phone,v_condition);
    end;
    commit;
    end loop;close c1;
    exception
    when others then
    rollback;end;
      

  2.   

    上面的更新用这个 掉了条件
    update A set conditon=v_condition,phone=v_phone where id =v_id;