光谷做网站推广哪家好,常州网站设计湛江公司电话,北京建设网上银行,公司营业执照怎么查询Merge into函数为Oracle 9i添加的语法#xff0c;用来合并update和insert语句。所以也经常用于update语句的查询优化#xff1a; 一、语法格式#xff1a;
merge into A
using B
on (A.a B.a) --注意on后面带括号#xff0c;且不能更新join的字段
when matched then
upd…Merge into函数为Oracle 9i添加的语法用来合并update和insert语句。所以也经常用于update语句的查询优化 一、语法格式
merge into A
using B
on (A.a B.a) --注意on后面带括号且不能更新join的字段
when matched then
update set A.b B.b
when not matched then
insert A (A.a,A.b) values (B.a,B.b) --也可以做delete语句二、性能方面Merge into优于updateMerge into只扫描一次全表Update子句扫描两次 三、使用需要注意的地方 ①update通常与exists搭配使用更新指定范围的数据而不是所有数据 ②改写update语句时有多个表的情况分析各个表的之间的关系写到on后面做关联 ③不等式的条件子句含不等式时通常需要将子句做转化到B表中外层再做关联。