回答

收藏

MERGE语句在Informix v10中不起作用

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

我尝试使用merge语句在Informix v10.0中进行插入/更新,但是会引发语法错误:
4 l" K2 Z8 \) c9 |  e. `; d  Pcreate table source(id int, account int, age int);0 i( z# f" q$ U% R" f
create table target (id int, account int, age int);. Z; U$ o8 {6 q  j& h' [
insert into source values(1, 1200, 25);5 A. h$ S5 g! W1 T( v: D, I/ L
insert into source values(2, 1300, 28);
0 V: [5 p7 K  g" Y6 B  Qinsert into source values(3, 1400, 45);7 b5 x5 ?; S3 T
merge into target t
( V% {; Q2 L" G; ^8 n  N" I3 g/ Pusing source s on t.id = s.id
& t: H9 r# V5 j, S" z5 Lwhen matched then
& |3 e+ y- q" L* p: r  P( H  Pupdate" J" t8 q; ?4 t! J$ w* v9 f$ F
set t.id = s.id, t.account = s.account, t.age = s.age
( z4 x9 Y. K2 c% x" ]! Z) pwhen not matched then( z5 x  }$ y% g
insert (t.id, t.account, t.age)& k. z1 z- F! F# k; A# N
values (s.id, s.account, s.age);
" \4 `' q3 _" _6 O; }select * from target;: {1 n# H$ G$ _# {
能否请你帮忙?1 i: b! C: \" {9 Y4 N
                8 [8 x; _# m8 L$ J* k
解决方案:
分享到:
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则