Sql 如何使用merge into语句更新表的所有值
如何使用merge into语句将源表中的所有值更新到目标表中 我想做的是:Sql 如何使用merge into语句更新表的所有值,sql,oracle,Sql,Oracle,如何使用merge into语句将源表中的所有值更新到目标表中 我想做的是: merge into src_table using (select * from dest) dest_table on (<some_condition>) when matched then update set src_table.* = dest_table.* where <condition> 我在谷歌上没有找到任何与此相关的东西。我知道可以使用execute immediate
merge into src_table
using (select * from dest) dest_table
on (<some_condition>)
when matched then update set src_table.* = dest_table.*
where <condition>
我在谷歌上没有找到任何与此相关的东西。我知道可以使用execute immediate样式语句来实现这一点,但我正在寻找更好的方法。可以使用pl/sql来实现
或者您可以使用alter table;
您必须明确指定要更新的每一列,除了on子句中使用的那些列之外——它们无法更新。那么为什么不使用alter rename呢?
for src in ( select * from B ) loop
update A set ROW = src where A.id = src.id;
end loop;
alter table your_table
rename to
your_new_table;