HGDB 兼容 Oracle 中 merge into using(APP)

本文介绍如何将Oracle数据库中的MERGE语句转换为适用于瀚高数据库(HGDB)的语法。通过两个具体示例,展示了在不同环境下进行数据更新和插入操作的转换过程。

目录

环境

文档用途

详细信息

相关文档

环境

系统平台:Microsoft Windows (64-bit) 10

版本:4.3.2

详细信息

orale中的merge语句的SQL如下:

 第一条merge语句

merge into test01 a using (select 1 as id, 'xxxx' as note from dual) b on (a.id=b.id) when matched then update set a.note=b.note when not matched then insert (a.id, a.note) values (b.id, b.note);

第二条merge语句

merge into test01 a using (select 1 as id, 'yyyy' as note from dual) b on (a.id=b.id) when matched then update set a.note=b.note when not matched then insert (a.id, a.note) values (b.id, b.note);

 转换成HGDB的语法如下:

 第一条merge语句 

WITH upsert as (update test01 m set note='xxxx' where id= 1 RETURNING m.* ), data as (select 1 as id, 'xxxx' as note) insert into test01 select * from data a where not exists(select 1 from upse rt b where a.id=b.id);

更多详细信息请登录【瀚高技术支持平台】 查看瀚高技术支持平台

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值