您能帮我将以下 Oracle语句转换为在 PostgreSQL 9.3 数据库中使用MERGE
的有效语句吗?UPSERT
MERGE INTO my_table a
USING (SELECT v_c1 key,
v_c2 AS pkey,
v_c3 AS wcount,
v_c4 AS dcount
FROM DUAL) b
ON ( a.key = b.key
AND a.pkey = b.pkey
WHEN MATCHED
THEN
UPDATE SET wcount = b.wcount,
dcount = b.dcount
WHEN NOT MATCHED
THEN
INSERT (key,
pkey,
wcount,
dcount)
VALUES(b.key,b.pkey,b.wcount,b.dcount);