ITPub博客

首页 > 数据库 > Oracle > oracle表对表的多行更新

oracle表对表的多行更新

原创 Oracle 作者:jinqibingl 时间:2015-02-13 23:44:41 0 删除 编辑

oracle并没有update from 这个写法。
所以在从一个表将数据更新到另外一个表时,无法使用update from写法,尤其是需要多行更新时,最好使用merge into。
merge into允许,将两个表基于某个或者某些字段进行比对,根据比对结果,match或者not match,而执行update或者insert甚至于delete操作。
示例:
merge into count_temp b using count_temp2 a on (a.count2=b.count2) when matched then update set a.count2=b.count2;

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/9606200/viewspace-1435678/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2010-08-19

  • 博文量
    154
  • 访问量
    325251