我试图将下面的oracle MERGE
语句转换为PostgreSQL中的等效语句。
Oracle查询:
MERGE INTO dest a
USING source b
ON (a.id = b.id)
WHEN MATCHED THEN
UPDATE SET a.code = b.code,
a.description = b.description
WHEN NOT MATCHED THEN
INSERT (id, code, description)
VALUES (b.id, b.code, b.description)
LOG ERRORS INTO err$_dest ('MERGE') REJECT LIMIT UNLIMITED;
上述合并声明的等价物:
INSERT INTO dest (id, code, description)
SELECT b.id, b.code, b.description
FROM source b
ON CONFLICT (id) DO UPDATE SET
code = EXCLUDED.code,
description = EXCLUDED.description;
有人可以解释如何找到这个子句的等价物
LOG ERRORS INTO err$_dest ('MERGE') REJECT LIMIT UNLIMITED;