oracle中merge into..using..on..when..when..用法
来源:互联网 发布:解码软件下载 编辑:程序博客网 时间:2024/05/18 02:36
<pre name="code" class="sql">merge into tfa_alarm_act_nms a using (select FP0,FP1,FP2,FP3,REDEFINE_SEVERITY from tfa_alarm_status) b on (a.fp0=b.fp0 and a.fp1=b.fp1 and a.fp2=b.fp2 and a.fp3=b.fp3) when matched then update set a.redefine_severity=b.redefine_severity when not matched then insert (a.fp0,a.fp1,a.fp2,a.fp3,a.org_severity,a.redefine_severity, a.event_time ,a.int_id) values (b.fp0,b.fp1,b.fp2,b.fp3,b.REDEFINE_SEVERITY,b.redefine_severity,sysdate,7777778);
作用:利用表 tfa_alarm_status跟新表tfa_alarm_act_nms 的b.redefine_severity,条件是a.fp0=b.fp0 and a.fp1=b.fp1 and a.fp2=b.fp2 and a.fp3=b.fp3,如果tfa_alarm_act_nms表中没有该条件的数据就插入。
如果你的数据量很大,此sql效率非常高。
0 0
- oracle中merge into..using..on..when..when..用法
- oracle中merge into..using..on..when..when..用法
- oracle中merge into..using..on..when..when..用法 使用一条语句实现update/insert 语句
- Oracle 中 merge into when 的用法分析。
- MERGE INTO USING ON WHEN MATCHED THEN WHEN NOT MATCHED THEN
- Oracle中case when用法
- Oracle merge into using 的用法
- Oracle sequence increased unexpected when using in merge statement
- oracle 中merge into用法
- oracle中merge into用法
- oracle数据库中 case when的用法
- Oracle中CASE WHEN的用法实例
- Oracle中CASE WHEN的用法实例
- Oracle中CASE WHEN的用法实例
- Oracle 中case when的用法
- oracle case when 用法
- Oracle case when 用法
- Oracle case when用法
- html css 仿微信底部自定义菜单
- Android平台中获取状态栏的高度代码实现
- UINavigationController应用之—-从无导航条push到有导航条
- 路由策略和策略路由
- 在普通用户下创建超级用户
- oracle中merge into..using..on..when..when..用法
- centos7 光盘本地yum源
- Opencv与matlab的混合编程
- Win7下Nginx的安装与配置
- 茵茵的第一课
- POJ 1275-Cashier Employment(差分约束系统)
- 算法练习:两数之和
- datatable重复行合并
- 十分钟让你明白Objective-C的语法(和Java、C++的对比)