带有左连接的Oracle Update sql为null

时间:2014-09-11 18:49:57

标签: oracle10g

我尝试创建Oracle代码,以STATUS = 'Resolved'的左侧联合更新TBL_RPT_CONS_2.ERR_MSG1 = TBL_OPENJOB.ERR_MSG,其中ERR_MSG1上的TBL_RPT_Cons_2为空。

Update TBL_RPT_CONS_2 Status
 Set STATUS = 'Resolved'
 FROM TBL_RPT_CONS_2 TBL_RPT_CONS_2
  LEFT OUTER JOIN TBL_OPENJOB TBL_OPENJOB
      ON (TBL_RPT_CONS_2.ERR_MSG1 = TBL_OPENJOB.ERR_MSG)
  WHERE     (TBL_OPENJOB.ERR_MSG IS NULL)
   AND (TBL_RPT_CONS_2.DOLV_REPORT_NAME = 'ICS1500-4')
   AND (TBL_RPT_CONS_2.STATUS = 'Open')

我可以使用select查看但无法更新。

SELECT TBL_RPT_CONS_2.STATUS
  FROM HRD_DEV.TBL_RPT_CONS_2 TBL_RPT_CONS_2
       LEFT OUTER JOIN HRD_DEV.TBL_OPENJOB TBL_OPENJOB
          ON (TBL_RPT_CONS_2.ERR_MSG1 = TBL_OPENJOB.ERR_MSG)
 WHERE     (TBL_OPENJOB.ERR_MSG IS NULL)
       AND (TBL_RPT_CONS_2.DOLV_REPORT_NAME = 'ICS1500-4')
       AND (TBL_RPT_CONS_2.STATUS = 'Open')

0 个答案:

没有答案