SQL Error: ORA-38104: Columns referenced in the ON Clause cannot be updated
SQL Error: ORA-38104: Columns referenced in the ON Clause cannot be updated
MERGE /*+ GATHER_PLAN_STATISTICS*/
INTO ATM_REQUEST ATM
USING ATM_STATUS_VIEW ST
ON ( ATM.accountno = ST.accountno
AND atm.status IS NULL
AND atm.remarks IS NULL)
WHEN MATCHED
THEN
UPDATE SET ATM.STATUS = ST.STATUS, ATM.REMARKS = ST.REMARKS;
我遇到了以下错误,任何人都可以帮助我解决这个问题。
Error at Command Line : 3 Column : 35
Error report -
SQL Error: ORA-38104: Columns referenced in the ON Clause cannot be updated: "ATM"."STATUS"
如其所说,您无法更新 ON
子句中引用的列。
也许你打算这样做:
MERGE /*+ GATHER_PLAN_STATISTICS*/
INTO ATM_REQUEST ATM
USING ATM_STATUS_VIEW ST
ON (ATM.accountno = ST.accountno)
WHEN MATCHED
THEN
UPDATE SET ATM.STATUS = ST.STATUS, ATM.REMARKS = ST.REMARKS
WHERE atm.status IS NULL
AND atm.remarks IS NULL
您在 ON
子句中使用了列 atm.status
,因此无法更改 UPDATE
子句。您可以将 IS NULL
条件移动到 UPDATE
子句中。
MERGE /*+ GATHER_PLAN_STATISTICS*/
INTO atm_request atm
USING atm_status_view st
ON (atm.accountno = st.accountno)
WHEN MATCHED
THEN
UPDATE SET atm.status = st.status, atm.remarks = st.remarks
WHERE atm.status IS NULL
AND atm.remarks IS NULL;
MERGE /*+ GATHER_PLAN_STATISTICS*/
INTO ATM_REQUEST ATM
USING ATM_STATUS_VIEW ST
ON ( ATM.accountno = ST.accountno
AND atm.status IS NULL
AND atm.remarks IS NULL)
WHEN MATCHED
THEN
UPDATE SET ATM.STATUS = ST.STATUS, ATM.REMARKS = ST.REMARKS;
我遇到了以下错误,任何人都可以帮助我解决这个问题。
Error at Command Line : 3 Column : 35
Error report -
SQL Error: ORA-38104: Columns referenced in the ON Clause cannot be updated: "ATM"."STATUS"
如其所说,您无法更新 ON
子句中引用的列。
也许你打算这样做:
MERGE /*+ GATHER_PLAN_STATISTICS*/
INTO ATM_REQUEST ATM
USING ATM_STATUS_VIEW ST
ON (ATM.accountno = ST.accountno)
WHEN MATCHED
THEN
UPDATE SET ATM.STATUS = ST.STATUS, ATM.REMARKS = ST.REMARKS
WHERE atm.status IS NULL
AND atm.remarks IS NULL
您在 ON
子句中使用了列 atm.status
,因此无法更改 UPDATE
子句。您可以将 IS NULL
条件移动到 UPDATE
子句中。
MERGE /*+ GATHER_PLAN_STATISTICS*/
INTO atm_request atm
USING atm_status_view st
ON (atm.accountno = st.accountno)
WHEN MATCHED
THEN
UPDATE SET atm.status = st.status, atm.remarks = st.remarks
WHERE atm.status IS NULL
AND atm.remarks IS NULL;