2016-02-12 33 views
0

我收到此錯誤錯誤的更新加入

這是我目前的錯誤:ORA-00971:通過選擇缺少SET關鍵字

UPDATE FGMULTI (JOIN arinvt ar 
ON fgmulti.arinvt_id = ar.id) 

SET NON_CONFORM_ALLOCATABLE = 'Y' 

WHERE IN_Date = CurrentDate 
    AND ar.Class LIKE 'CP%' 
    (OR ar.Class LIKE 'FG%' 
    OR ar.Class LIKE 'IN%' 
    OR ar.Class LIKE 'LA%' 
    OR ar.Class LIKE 'PK%') 
+0

您需要發佈您的代碼,否則我們幫不了你。 –

+1

下一次提供您的代碼我已發佈答案無論如何.. – scaisEdge

+0

此外,下次您發佈代碼 - 不要在圖片中。實際上在這裏複製/粘貼查詢或代碼。 – NotMe

回答

1

使用更新加入

UPDATE (select NON_CONFORM_ALLOCTABLE 
     from FGMULTI 
      JOIN arinvt ar 
      ON fgmulti.arinvt_id = ar.id 
     WHERE IN_Date = CurrentDate 
     AND ar.Class LIKE 'CP%' 
     OR ar.Class LIKE 'FG%' 
     OR ar.Class LIKE 'IN%' 
     OR ar.Class LIKE 'LA%' 
     OR ar.Class LIKE 'PK%') t 
SET t.NON_CONFORM_ALLOCATABLE = 'Y' 
+0

我看你的評論代碼,你有其他錯誤(在錯誤的地方)我已更新asnwer,如果這是正確的,請將其標記爲接受.. – scaisEdge

+0

我還沒有看到左外部連接.. 。然後左外部連接不工作,但只是加入是的..我已更新答案 – scaisEdge

+0

請..如果我提供的答案產生的錯誤或錯誤的結果顯示的錯誤或錯誤的結果..不評論與新的SQL命令無法理解你在做什麼..沒有適當的解釋 – scaisEdge

0

在UPDATE語句中,您不能在Oracle中使用JOIN。你可以做,使用和exists條款:

UPDATE FGMULTI 
    SET NON_CONFORM_ALLOCATABLE = 'Y' 
WHERE IN_Date = CurrentDate 
    AND exists (SELECT 1 
       FROM arinvt ar 
       WHERE fgmulti.arinvt_id = ar.id 
       AND (ar.Class LIKE 'CP%' 
       OR ar.Class LIKE 'FG%' 
       OR ar.Class LIKE 'IN%' 
       OR ar.Class LIKE 'LA%' 
       OR ar.Class LIKE 'PK%'));