Oracle实现将一个表字段更新到另一个表

1.使用Update命令

UPDATE A SET A.name = (SELECT B.name FROM B WHERE A.id= B.id)
WHERE EXISTS (SELECT 1 FROM B WHERE B.id= A.id)

2.使用MERGE语句

Merge into A a using B b on (a.id = b.id)
when matched then update set a.name = b.name

你可能感兴趣的:(oracle,数据库,sql)