ORA-38104: Columns referenced in the ON Clause cannot be updated: "U"."USER_ID"
2014-03-08 12:12
661 查看
在用merge语句更新一个表的时候报错:
SQL> merge into OUTSITE_USERINFO u
2 using tmp_update_newlib ut
3 on (u.user_id = ut.NEWCOURSE_ID)
4 when matched then
5 update set u.user_id = ut.NEWLIB_ID;
on (u.user_id = ut.NEWCOURSE_ID)
*
ERROR at line 3:
ORA-38104: Columns referenced in the ON Clause cannot be updated: "U"."USER_ID"
看错误意思大概是不能更新on条件引用的列
查看官方文档,确实如此:
merge_update_clause
Restrictions on the merge_update_clause This
clause is subject to the following restrictions:
You cannot update a column that is referenced in the
这种情况可以用update语句去更新
SQL> update OUTSITE_USERINFO set user_id=(select NEWLIB_ID from tmp_update_newlib where OUTSITE_USERINFO.user_id=tmp_update_newlib.N
EWCOURSE_ID)
2 where user_id in (select OUTSITE_USERINFO.user_id from OUTSITE_USERINFO,tmp_update_newlib where OUTSITE_USERINFO.user_id=tmp_up
date_newlib.NEWCOURSE_ID);
1 row updated.
记录一下。
SQL> merge into OUTSITE_USERINFO u
2 using tmp_update_newlib ut
3 on (u.user_id = ut.NEWCOURSE_ID)
4 when matched then
5 update set u.user_id = ut.NEWLIB_ID;
on (u.user_id = ut.NEWCOURSE_ID)
*
ERROR at line 3:
ORA-38104: Columns referenced in the ON Clause cannot be updated: "U"."USER_ID"
看错误意思大概是不能更新on条件引用的列
查看官方文档,确实如此:
merge_update_clause
Restrictions on the merge_update_clause This
clause is subject to the following restrictions:
You cannot update a column that is referenced in the
ON
conditionclause.
这种情况可以用update语句去更新
SQL> update OUTSITE_USERINFO set user_id=(select NEWLIB_ID from tmp_update_newlib where OUTSITE_USERINFO.user_id=tmp_update_newlib.N
EWCOURSE_ID)
2 where user_id in (select OUTSITE_USERINFO.user_id from OUTSITE_USERINFO,tmp_update_newlib where OUTSITE_USERINFO.user_id=tmp_up
date_newlib.NEWCOURSE_ID);
1 row updated.
记录一下。
相关文章推荐
- 打开Eclipse提示“The default workspace “xxxx” is in use or cannot be created Please choose a different on
- "The object cannot be deleted because it was not found in the ObjectStateManager."
- eclipse提示“the default workspace "D:/*****"is in use or cannot be created.Please choose a different”
- (1048, "Column 'user_id' cannot be null")
- uploaddify 报错 "ID SWFUpload_0 is already in use. The Flash Object could not be added"
- Sqlachemy的警告SAWarning: The IN-predicate on "sns_object.BIZ_ID" was invoked with an empty sequence. This results in a contradiction, which nonetheless can be expensive to evaluate.
- ORA-04031 With Leak in "OBJ STAT MEMO" Allocations Seen in V$SGASTAT on 10.2.0.5 (文档 ID 1350050.1)
- 解决 "The absolute uri: xxx cannot be resolved in either web.xml or the jar files"
- 使用idea 标签库报"The absolute uri: xxx cannot be resolved in either web.xml or the jar files"
- yii提示The table "xxx" for active record class "DistAR" cannot be found in the database
- 解决"the database principal owns a schema in the database and cannot be dropped"问题
- Error in acquiring locks: Locks on the underlying objects cannot be acquired. retry after some time
- 打开Eclipse提示“The default workspace “xxxx” is in use or cannot be created Please choose a different on
- PowerShell: 如何解决File **.ps1 cannot be loaded because the execution of scripts is disabled on this system. Please see "get- help about_sig" for more de
- ORA-38104: 无法更新 ON 子句中引用的列: "A"."CAMPAIGNID"
- ORA-38104: 无法更新 ON 子句中引用的列: "A"."MAINID"
- 【明哥报错簿】之【 "javax.servlet.http.HttpServlet" was not found on the Java Build Path || HttpServletRequest/HttpServletResponse cannot be resolved to a type】
- The description for Event ID ( 27745 ) in Source ( Windows SharePoint Services 3 ) cannot be found问题解决
- How to allow a user to click on TextBlocks which return an integer ID in the click handler
- CRS-2800: Cannot start resource 'ora.DATADG.dg' as it is already in the INTERMEDIATE state on se