当前位置:网站首页>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.
边栏推荐
- 基于宽表的数据建模应用
- Charm of code language
- 使用el-upload封装得组件怎么清空已上传附件
- The comparison of every() and some() in JS uses a power storage plan
- Observation cloud and tdengine have reached in-depth cooperation to optimize the cloud experience of enterprises
- How to use sqlcipher tool to decrypt encrypted database under Windows system
- TDengine 已经支持工业英特尔 边缘洞见软件包
- Small program startup performance optimization practice
- Roll up, break through 35 year old anxiety, and animate the CPU to record the function call process
- Three-level distribution is becoming more and more popular. How should businesses choose the appropriate three-level distribution system?
猜你喜欢
Charm of code language
Mobile heterogeneous computing technology GPU OpenCL programming (Advanced)
Small program startup performance optimization practice
Oracle combines multiple rows of data into one row of data
让AI替企业做复杂决策真的靠谱吗?参与直播,斯坦福博士来分享他的选择|量子位·视点...
Solve the problem of no all pattern found during Navicat activation and registration
How to choose the right chain management software?
Node の MongoDB Driver
A keepalived high availability accident made me learn it again
解决idea调试过程中liquibase – Waiting for changelog lock….导致数据库死锁问题
随机推荐
Observation cloud and tdengine have reached in-depth cooperation to optimize the cloud experience of enterprises
【两个对象合并成一个对象】
让AI替企业做复杂决策真的靠谱吗?参与直播,斯坦福博士来分享他的选择|量子位·视点...
About getfragmentmanager () and getchildfragmentmanager ()
Are databases more popular as they get older?
Community group buying exploded overnight. How should this new model of e-commerce operate?
Understanding of smt32h7 series DMA and DMAMUX
Apache DolphinScheduler 入门(一篇就够了)
TDengine 已经支持工业英特尔 边缘洞见软件包
【数组的中的某个属性的监听】
微信小程序获取住户地区信息
Understand the window query function of tdengine in one article
Evolution of Baidu intelligent applet patrol scheduling scheme
基于模板配置的数据可视化平台
写入速度提升数十倍,TDengine 在拓斯达智能工厂解决方案上的应用
Node の MongoDB Driver
SQL learning - case when then else
百度智能小程序巡檢調度方案演進之路
[sorting of object array]
从“化学家”到开发者,从甲骨文到TDengine,我人生的两次重要抉择