【问题标题】:MERGE Statement is not working in Informix v10MERGE 语句在 Informix v10 中不起作用
【发布时间】:2021-02-14 05:07:49
【问题描述】:

我尝试在 Informix v10.0 中使用合并语句插入/更新 但它会引发语法错误:

create table source(id int, account int, age int);
create table target (id int, account int, age int);

insert into source values(1, 1200, 25);
insert into source values(2, 1300, 28);
insert into source values(3, 1400, 45);

merge into target t 
using source s on t.id = s.id
when matched then
update
set t.id = s.id, t.account = s.account, t.age = s.age
when not matched then
insert (t.id, t.account, t.age)
values (s.id, s.account, s.age);

select * from target;

你能帮忙吗?

【问题讨论】:

    标签: sql informix insert-update


    【解决方案1】:

    MERGE 语句在 Informix 10.00 中不可用。它是在 11.50 中添加的——请参阅 SQL 语法手册中的 MERGE statementnew features 页面表明它是在 11.50.xC6 中添加的,这是维护发布周期的一部分。

    请注意,版本 10.00 和所有 11.x 版本(11.10、11.50、11.70)均不受支持。 11.70 版已于 2020 年 10 月 1 日停止支持。

    【讨论】:

    • 由于 11.50 和 11.70 都不受支持,我不确定这些链接的有效期。第一个现在存档在 WayBack Machine 中,地址为MERGE statement;第二个已在new features 上提供。
    猜你喜欢
    • 2020-05-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-05-22
    • 2018-08-11
    相关资源
    最近更新 更多