update rs_insure_pay_set b set b.money_person=0,b.money_company=0 from rs_emp_nature_attrib a  where a.emp_id=b.emp_id and b.insure_kind=8 and   a.EMP_HIRE_KIND='40015'
  这个语句在SQLSERVE中可以执行,但在ORACLE中不能用,请帮忙

解决方案 »

  1.   

    update rs_insure_pay_set b, rs_emp_nature_attrib a set b.money_person=0,b.money_company=0 where a.emp_id=b.emp_id and b.insure_kind=8 and   a.EMP_HIRE_KIND='40015'orupdate rs_insure_pay_set b set b.money_person=0,b.money_company=0 where rs_emp_nature_attrib.emp_id=b.emp_id and b.insure_kind=8 and   rs_emp_nature_attrib.EMP_HIRE_KIND='40015'
      

  2.   

    查出2表相关联的id,进行单表update,注意,别忘了提交!
      

  3.   

    update rs_insure_pay_set b, rs_emp_nature_attrib a set b.money_person=0,b.money_company=0 where a.emp_id=b.emp_id and b.insure_kind=8 and   a.EMP_HIRE_KIND='40015'出错,提示缺少SET关键字
      

  4.   

    update rs_insure_pay_set b set b.money_person=0,b.money_company=0 where rs_emp_nature_attrib.emp_id=b.emp_id and b.insure_kind=8 and   rs_emp_nature_attrib.EMP_HIRE_KIND='40015'
    出错,提示rs_emp_nature_attrib.EMP_HIRE_KIND无效的标识符
      

  5.   

    update rs_insure_pay_set b set b.money_person=0,b.money_company=0 where exist(select 1 from rs_emp_nature_attrib a where a.emp_id=b.emp_id and b.insure_kind=8 and   a.EMP_HIRE_KIND='40015')这样okay~~~
      

  6.   

    update rs_insure_pay_set b set b.money_person=0,b.money_company=0 where exist(select 1 from rs_emp_nature_attrib a where a.emp_id=b.emp_id and b.insure_kind=8 and   a.EMP_HIRE_KIND='40015')出错,缺少表达式
      

  7.   

    update rs_insure_pay_set b set (b.money_person,b.money_company) = (SELECT 0, 0 FROM DUAL) where exist(select 1 from rs_emp_nature_attrib a where a.emp_id=b.emp_id and b.insure_kind=8 and   a.EMP_HIRE_KIND='40015')这样可以了8!~~~~~~
      

  8.   

    错误是什么?要不楼主自己看看这个吧。
    http://www.ahaoz.com/Article/2/249/2005/20051123116780.html
      

  9.   

    update rs_insure_pay_set b set (b.money_person,b.money_company)=(select 0,0 from rs_emp_nature_attrib a  where a.emp_id=b.emp_id and b.insure_kind=8 and a.emp_id=911 and   a.EMP_HIRE_KIND='40015')
    where exists (select 1 from rs_emp_nature_attrib a  where a.emp_id=b.emp_id and b.insure_kind=8 and a.emp_id=911 and   a.EMP_HIRE_KIND='40015')
    这样可以了,不过,还是谢谢你!