I am trying to covert the below oracle MERGE
statement to equivalent in PostgreSQL.
Oracle query:
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;
Equivalent for the above merge statement:
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;
Can somebody explain how to find equivalent for this clause
LOG ERRORS INTO err$_dest ('MERGE') REJECT LIMIT UNLIMITED;