HGDB 兼容 Oracle 中 merge into using(APP)

目录

环境

文档用途

详细信息

相关文档

环境

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

版本:4.3.2

详细信息

orale中的merge语句的SQL如下:

 第一条merge语句

扫描二维码关注公众号,回复: 9185618 查看本文章
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);

更多详细信息请登录【瀚高技术支持平台】 查看https://support.highgo.com/#/index/docContent/a0c66fe404926d2b

发布了399 篇原创文章 · 获赞 108 · 访问量 65万+

猜你喜欢

转载自blog.csdn.net/pg_hgdb/article/details/101689416