update account_money set account_money.ssye = (SELECT  account_money.ssye + fund_apply_original_return.authorize_pay
  from fund_apply_original_return
 where account_money.year = fund_apply_original_return.year and 
 account_money.unit_code = fund_apply_original_return.budget_unit and 
 account_money.subject_code = fund_apply_original_return.subject_code and
 account_money.item_code = nvl(fund_apply_original_return.item_code,'0')

解决方案 »

  1.   

    少了半边括号:)
    update account_money set account_money.ssye = (SELECT  account_money.ssye + fund_apply_original_return.authorize_pay
      from fund_apply_original_return
     where account_money.year = fund_apply_original_return.year and 
     account_money.unit_code = fund_apply_original_return.budget_unit and 
     account_money.subject_code = fund_apply_original_return.subject_code and
     account_money.item_code = nvl(fund_apply_original_return.item_code,'0'));
      

  2.   

    to bzszp(www.bzszp.533.net) :
    多谢你,可是我要修改的是很多字段,如下
    update account_money set 
    account_money.ssye = account_money.ssye+fund_apply_original_return.authorize_pay,
    account_money.column2 = account_money.column2 + fund_apply_original_return.column2
    .......
      from account_money,fund_apply_original_return
     where account_money.year = fund_apply_original_return.year and 
     account_money.unit_code = fund_apply_original_return.budget_unit and 
     account_money.subject_code = fund_apply_original_return.subject_code and
     account_money.item_code = nvl(fund_apply_original_return.item_code,'0')
    这样该如何写呢?
      

  3.   

    对应去写
    update account_money set (account_money.ssye,account_money.xxx) = (SELECT  account_money.ssye + fund_apply_original_return.authorize_pay,
    account_money.xxx + fund_apply_original_return.yyy
      from fund_apply_original_return
     where account_money.year = fund_apply_original_return.year and 
     account_money.unit_code = fund_apply_original_return.budget_unit and 
     account_money.subject_code = fund_apply_original_return.subject_code and
     account_money.item_code = nvl(fund_apply_original_return.item_code,'0'));
      

  4.   

    update account_money set (account_money.ssye,COL2,COL3,...) = (SELECT  account_money.ssye + fund_apply_original_return.authorize_pay,COL222,COL333,...<--只要这里对应就行了
      from fund_apply_original_return
     where account_money.year = fund_apply_original_return.year and 
     account_money.unit_code = fund_apply_original_return.budget_unit and 
     account_money.subject_code = fund_apply_original_return.subject_code and
     account_money.item_code = nvl(fund_apply_original_return.item_code,'0'));
      

  5.   

    我试了一下,但是有返回错误信息是“但行子查询返回多于一个行”,我的UPDATE语句改动的不止一行数据,是不是不支持啊??
      

  6.   

    不是这个原因
    而是对于某一行执行更新的时候,检索出多行符合条件的数据,系统当然就无法进行更新了。
    加上MAX(),MIN(),AVG等函数可以解决,但不推荐,因为是数据的对应关系有问题!
      

  7.   

    bzszp(www.bzszp.533.net) ,接分