更新加入时出错

时间:2016-02-12 16:47:29

标签: sql oracle sql-update

我收到此错误

这是我的当前错误: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%')

2 个答案:

答案 0 :(得分:2)

使用update for join

 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' 

答案 1 :(得分:0)

You can't use a ... skills = models.ManyToManyField(Skill,...) ... in Oracle in an UPDATE statement. You can do that using and JOIN clause:

exists