update Target set tFunds=(select tFunds+nvl(sFunds,0) from source where sBillNo(+)=tBillNo);

解决方案 »

  1.   

    update target set tFunds =tFunds +(select sFunds from source where tfunds.tBillNo =source.sbillno)
      

  2.   

    update target set tFunds =tFunds +NVL((select sFunds from source where tfunds.tBillNo =source.sbillno),0)
      

  3.   

    本来只是想在tuidler() 的基础上加上NVL()保护,否则会将未包含在source 中的tFunds 置为NULL! 后来才发现他的SQL有笔误,呵呵...update target set tFunds =tFunds +NVL((select sFunds from source where target.tBillNo =source.sbillno),0)
      

  4.   

    还是beckhambobo(beckham) 的可以,期于的怎么不行呀,我也这么写的,但说我错了
    SQL>  update table1 set b=b+NVL((select d from table2 where table2.c=table1.a),0);
     update table1 set b=b+NVL((select d from table2 where table2.c=table1.a),0)
                                *
    ERROR 位于第 1 行:
    ORA-00936: 缺少表达式
      

  5.   

    Lastdrop(空杯)
    加上NVL保护确实是个好主意,给你加分
    如果目标表上有两列需更改,如何写呢?
      

  6.   

    update a set (col1,col2)=(select a.col1+nvl(b.col1,0),a.col2+nvl(b.col2,0) from b where b.id(+)=a.id);
      

  7.   

    目标表上有两列需要修改,就看你要修改的值是什么了,如果其他是常量与普通的方法没有什么不同update target set tFunds =tFunds +NVL((select sFunds from source where target.tBillNo =source.sbillno),0), other_field=other_value 如果也是需要从表source中取值,就得用beckhambobo(beckham) 这样的子查询了。