Oracle Merge into使用小节(一)
来源:互联网 发布:淘宝网官方下载 编辑:程序博客网 时间:2024/06/05 04:11
Merge into 命令在Mybatis中如何使用
Merge into同一张表
模板
merge into 目标表 a
using 源表 b
on(a.条件字段1=b.条件字段1……)
when matched then update set a.更新字段=b.字段
when not macthed then insert into a(字段1,字段2……)values(值1,值2……)
源表b中查出的结果表示本次结果可以更改的结果集数量on(条件)中的结果是匹配原则
实现
merge into Table aUSING (select count(1) as cnt from Tablewhere ID = #{id, jdbcType=TIMESTAMP}and CHANNEL_ID = #{channelId, jdbcType=INTEGER}) bon (b.cnt>0and a.ID= #{id, jdbcType=TIMESTAMP}and a.CHANNEL_ID = #{channelId, jdbcType=INTEGER})when MATCHED thenupdate set a.COUNT = a.COUNT + 1when not MATCHED theninsert (<if test="id != null"> a.ID,</if><if test="channelId != null"> a.CHANNEL_ID,</if><if test="count != null"> a.COUNT</if>)values(<if test="id != null"> #{id,jdbcType=VARCHAR},</if><if test="channelId != null"> #{channelId,jdbcType=INTEGER},</if><if test="count != null"> #{count,jdbcType=INTEGER},</if>)
阅读全文
0 0
- Oracle Merge into使用小节(一)
- merge into(oracle)
- oracle merge into的使用
- oracle-Merge into的使用
- oracle merge into的使用
- Oracle使用Merge into 注意事项
- Oracle-Merge into使用详解
- Oracle中Merge into使用
- Oracle存储过程之merge into 函数(一)
- Oracle中merge into的使用
- Oracle中merge into的使用
- Oracle中merge into的使用
- oracle 中 merge into 的使用
- Oracle中merge into的使用
- Oracle中merge into的使用
- Oracle中merge into的使用
- Oracle中merge into的使用
- Oracle中merge into的使用
- java:String使用equals和==比较的区别
- 推荐.Net、C# 逆向反编译四大工具利器
- JAVA 反射 (4):Class类方法详解
- python核心编程第二版第八章学习笔记
- jQuery.extend 函数详解
- Oracle Merge into使用小节(一)
- iPhone SE2再爆黑科技,高配置组合!搭配双卡双待?
- 关于.NET编译的目标平台(AnyCPU,x86,x64)
- Unity中Debug的用法
- Unicode转成中文
- 机器学习实战之一---简单讲解决策树
- Unity计时器(二)
- java8中Collectors的学习
- Python海量数据处理之_单机优化