update B set B.num = A.num
from A,B
where A.id = B.id;commit;

解决方案 »

  1.   

    这样:
    update B set num=
        (select num from A where A.id=B.id)
     where exists
        (select 'X' from A where A.id=B.id)
      

  2.   

    begin
    for a in (select id ,num from a )
    loop
    update b
    set num = a.num 
    where id = a.id;
    end loop;
    commit;
    end;
      

  3.   

    to : yefengdn(我爱我家) 
    ora8i的版本可以这样写吗??
    ora9i的版本也可以吗??
      

  4.   

    yefengdn(我爱我家)
    的是错的sql hrb_qiuyb(晨钟暮鼓) 的能执行过
    但数据没有被移植.haifeng1012(海风)的没测试,觉得不是最优的sql.不晓得还有不有方法
      

  5.   

    在oracle中更新语句中不能同时连接两个表,所以我用游标实现!!
    还有其他的方法吗??
    studying...
      

  6.   

    update b set num=(select num from a where a.id=b.id);这样应该可以了!!如果没有别的要求欧!!
      

  7.   

    to  hrb_qiuyb(晨钟暮鼓):update B set num=
        (select num from A where A.id=B.id)就可以了
    为什么要加
    where exists
        (select 'X' from A where A.id=B.id)
    呢???????????
      

  8.   

    to : chinadrencher(南海的天)
    你测试过update b set num=(select num from a where a.id=b.id);语句了,能实现你要的功能吗??
      

  9.   

    update B set num=
        (select num from A where A.id=B.id)对啊,就够了:)
      

  10.   

    update B set num=
        (select num from A where A.id=B.id)
    如果A 中没有重复的id就行