当前位置:网站首页>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.
边栏推荐
- 使用el-upload封装得组件怎么清空已上传附件
- 正式上架!TDengine 插件入驻 Grafana 官网
- Project practice | excel export function
- 解决Navicat激活、注册时候出现No All Pattern Found的问题
- Kotlin Compose 与原生 嵌套使用
- Resolve the horizontal (vertical) sliding conflict between viewpager and WebView
- Optimize database queries using the cursor object of SQLite
- 【两个对象合并成一个对象】
- [sorting of object array]
- 【OpenCV 例程200篇】219. 添加数字水印(盲水印)
猜你喜欢

百度APP 基于Pipeline as Code的持续集成实践

What are the advantages of the live teaching system to improve learning quickly?

初识结构体

Tdengine already supports the industrial Intel edge insight package

Generics, generic defects and application scenarios that 90% of people don't understand

Kotlin Compose 与原生 嵌套使用

Charm of code language

Apache dolphin scheduler system architecture design

Mobile heterogeneous computing technology GPU OpenCL programming (Advanced)

Node の MongoDB Driver
随机推荐
Unity skframework framework (24), avatar controller third person control
从“化学家”到开发者,从甲骨文到TDengine,我人生的两次重要抉择
Tutorial on building a framework for middle office business system
Lepton 无损压缩原理及性能分析
揭秘百度智能测试在测试自动执行领域实践
Understanding of smt32h7 series DMA and DMAMUX
小程序启动性能优化实践
Tdengine already supports the industrial Intel edge insight package
[how to disable El table]
Online chain offline integrated chain store e-commerce solution
Small program startup performance optimization practice
[hungry dynamic table]
Why do offline stores need cashier software?
Apache DolphinScheduler 入门(一篇就够了)
TDengine × Intel edge insight software package accelerates the digital transformation of traditional industries
Evolution of Baidu intelligent applet patrol scheduling scheme
Android privacy sandbox developer preview 3: privacy, security and personalized experience
View Slide
TDengine ×英特尔边缘洞见软件包 加速传统行业的数字化转型
Develop and implement movie recommendation applet based on wechat cloud