平常的开发中通常都是写的单表update语句,不多写多表关联的update。html
不一样于SQL Server,在Oracle中,update的多表链接更新和select的多表链接查询在使用的方法上存在较大差别。ios
语法比较难以说得清楚,直接上例子就妥了。post
update diosos_01 d1
set d1.name = (
select d2.name
from diosos_02 d2
where d1.code = d2.code
)
where d1.code is not null;
特别之处在于,两个表之间的关联关系是在子查询中的WHERE子句中创建的。spa
"哪里会有人喜欢孤独,不过是不喜欢失望。"code