当前位置:网站首页>oracle和mysql批量Merge对比
oracle和mysql批量Merge对比
2022-07-05 09:37:00 【51CTO】
orm框架采用mybatis,本博客介绍一下批量合并merge用oracle和mysql来做的区别,
oracle merge合并更新函数的详细介绍可以参考我以前的博客
<!-- 批量更新新增关联信息 oracle-->
<insert id="batchSaveTipsRelatedConfig" databaseId="oracle" parameterType="com.extend.tipsConfig.model.TipsRelatedModel">
MERGE INTO t_tips_config_related A1
USING(<foreach collection="relatedTipsList" item="itm" separator="union">select #{itm.seq} seq ,
#{itm.tipsSeq} tipsSeq ,
#{itm.relaSeq} relaSeq,
#{itm.tipsContent} tipsContent
from dual
</foreach>) A2
ON(A1.tips_seq = A2.tipsSeq and A1.rela_seq = A2.relaSeq)
WHEN MATCHED THEN
UPDATE SET
A1.tips_content = A2.tipsContent
WHEN NOT MATCHED THEN
INSERT(seq , tips_seq , rela_seq, tips_content)
VALUES(A2.seq , A2.tipsSeq ,A2.relaSeq, A2.tipsContent)
</insert>
- 1.
- 2.
- 3.
- 4.
- 5.
- 6.
- 7.
- 8.
- 9.
- 10.
- 11.
- 12.
- 13.
- 14.
- 15.
- 16.
- 17.
mysql方法:
<!-- 批量更新新增关联信息 mysql-->
<insert id="batchSaveTipsRelatedConfig" databaseId="mysql" parameterType="com.extend.tipsConfig.model.TipsRelatedModel">
REPLACE INTO t_tips_config_related(seq,tips_seq,rela_seq,tips_content)
VALUES<foreach collection="relatedTipsList" item="itm" separator=",">(#{itm.seq},
#{itm.tipsSeq},
#{itm.relaSeq},
#{itm.tipsContent})</foreach>
</insert>
- 1.
- 2.
- 3.
- 4.
- 5.
- 6.
- 7.
- 8.
边栏推荐
猜你喜欢

tongweb设置gzip

为什么不建议你用 MongoDB 这类产品替代时序数据库?

H. 265 introduction to coding principles

Community group buying has triggered heated discussion. How does this model work?
![[technical live broadcast] how to rewrite tdengine code from 0 to 1 with vscode](/img/d8/a367c26b51d9dbaf53bf4fe2a13917.png)
[technical live broadcast] how to rewrite tdengine code from 0 to 1 with vscode

SQL learning - case when then else

Uncover the practice of Baidu intelligent testing in the field of automatic test execution

Solve liquibase – waiting for changelog lock Cause database deadlock

Kotlin Compose 与原生 嵌套使用

Viewpager pageradapter notifydatasetchanged invalid problem
随机推荐
【数组的中的某个属性的监听】
Tutorial on building a framework for middle office business system
Unity skframework framework (24), avatar controller third person control
解决Navicat激活、注册时候出现No All Pattern Found的问题
搞数据库是不是越老越吃香?
分布式数据库下子查询和 Join 等复杂 SQL 如何实现?
卷起来,突破35岁焦虑,动画演示CPU记录函数调用过程
H. 265 introduction to coding principles
卷起來,突破35歲焦慮,動畫演示CPU記錄函數調用過程
Generics, generic defects and application scenarios that 90% of people don't understand
Vs code problem: the length of long lines can be configured through "editor.maxtokenizationlinelength"
Single chip microcomputer principle and Interface Technology (esp8266/esp32) machine human draft
[200 opencv routines] 219 Add digital watermark (blind watermark)
从“化学家”到开发者,从甲骨文到TDengine,我人生的两次重要抉择
mysql安装配置以及创建数据库和表
Principle and performance analysis of lepton lossless compression
写入速度提升数十倍,TDengine 在拓斯达智能工厂解决方案上的应用
La voie de l'évolution du système intelligent d'inspection et d'ordonnancement des petites procédures de Baidu
移动端异构运算技术-GPU OpenCL编程(进阶篇)
[hungry dynamic table]