回答

收藏

MERGE语句在Informix v10中不起作用

技术问答 技术问答 478 人阅读 | 0 人回复 | 2023-09-11

我尝试使用merge语句在Informix v10.0中进行插入/更新,但是会引发语法错误:. u3 Y: Z  A0 h% L7 q& w
create table source(id int, account int, age int);, F. p1 ?0 A' {
create table target (id int, account int, age int);  j5 Y. O' v7 O/ R# T* ]
insert into source values(1, 1200, 25);
4 @# y) X6 e2 x, d- ?, Minsert into source values(2, 1300, 28);
+ `0 m  S0 k, [* j: }- P( vinsert into source values(3, 1400, 45);5 @. Q  x6 r2 s- u! e
merge into target t / m: O8 B# @+ y% k; _( |
using source s on t.id = s.id
4 N, x# S" }* mwhen matched then/ F) x2 _/ N; Z+ b) F: T
update
( b4 w, l# S* M' N( q. t: x8 o9 aset t.id = s.id, t.account = s.account, t.age = s.age
$ P! r: E( R& \$ A0 K, @/ f5 Cwhen not matched then& W6 h# \1 v$ X
insert (t.id, t.account, t.age)
% U- g4 x" w+ ^values (s.id, s.account, s.age);: Y5 m4 i4 q( l+ Z0 v9 u$ G/ _
select * from target;  c, k' Y& \  P1 E9 ^* z' ~7 M
能否请你帮忙?
/ o6 y9 Y$ P7 Y               
8 T1 `% m: Q) T; @解决方案:
分享到:
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则