错误的更新加入
我收到此错误错误的更新加入
这是我目前的错误: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%')
回答:
使用更新加入
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'
回答:
在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%'));
以上是 错误的更新加入 的全部内容, 来源链接: utcz.com/qa/258208.html