带有内连接的 Oracle Update 语句
我正在尝试编写一个带有内部联接的简单更新语句,但是我在 SQL Server 中执行此操作的方式似乎不适用于 ORACLE。这是更新:
UPDATE D
SET D.USER_ID = C.USER_ID
FROM D INNER JOIN C
ON D.MGR_CD = C.MGR_CD WHERE D.USER_ID IS NULL;
我收到的错误似乎是在 FROM
上。有人可以解释一下这是什么原因以及如何解决它吗?
I am trying to write a simple update statement with an inner join, but the way I would do this in SQL server does not seem to be working in ORACLE. Here is the Update:
UPDATE D
SET D.USER_ID = C.USER_ID
FROM D INNER JOIN C
ON D.MGR_CD = C.MGR_CD WHERE D.USER_ID IS NULL;
It seems like the error I am getting is on the FROM
. Can someone explain to meet what the cause of this is and how to work around it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在 Oracle 中,不能在
更新
语句这样。以下任何一项都应该有效。但是,我更喜欢在这种情况下使用 MERGE:
In Oracle, you can't use a
from
clause in anupdate
statement that way. Any of the following should work.However, my preference is to use
MERGE
in this scenario: