解决方案 »

  1.   

    SELECT B_ID, B_NAME, NVL(A_PRICE, B_PRICE)
      FROM A, B
     WHERE B.B_ID = A.A_ID(+)
      

  2.   

    update b set b.b_price = (select a.a_price from a where a.a_id=b.b_id)
      

  3.   

    sorry,没看到你的需求是update, #2++
      

  4.   


    -- 加一个 exists 条件,不然找不到记录时,就更新成 NULL 了。
    -- PS :  update 语句是拷的 2# 这个兄弟的update b set b.b_price = (select a.a_price from a where a.a_id=b.b_id)
    where exists(select * from a where a.a_id=b.b_id)
      

  5.   

    update b set b.b_price = (select a.a_price from a where a.a_id=b.b_id)
    where exists(select * from a where a.a_id=b.b_id)
    这个也是不行啊。报orac-01407 的错
      

  6.   


    检查一下你的 a 表,看看 a_price 是不是 null 值;
      

  7.   

    再加个条件过滤下就是了
    update b set b.b_price = (select a.a_price from a where a.a_id=b.b_id)
    where exists(select * from a where a.a_id=b.b_id and a.a_price is not null)