我无法在我的请求中发现问题。这是我的请求和2表:
UPDATE RESERVATION inner join client on reservation.numcl = client.numcl
SET reservation.numcl2 = client.numcl2;
错误:
=> [42000][971] ORA-00971: missing SET keyword
表客户端 Client table
预订客户 reservation table
解决方案:
UPDATE RESERVATION SET reservation.numcl2 = (select client.NUMCL2
from CLIENT
where client.NUMCL= RESERVATION.numcl);
答案 0 :(得分:0)
Oracle不支持join
中的update
(至少是明确的)。您想要做的事情的等价物是:
UPDATE RESERVATION r
SET numcl2 = (select client.NUMCL2
from CLIENT c
where c.NUMCL = r.numcl
)
WHERE EXISTS (SELECT 1 FROM client c WHERE c.NUMCL = r.numcl);
如果你想处理没有匹配的情况,exists
很重要。