Vinodh NV wrote:
> Sir,
> I am facing the error Caused by: org.postgresql.util.PSQLException: ERROR:
> syntax error at or near "merge". when I execute the below  query in
> postgres database. The same works fine in Oracle.
> merge into net n using dual on ( when matched then update set
> Status=:status, lastStatusDate=:lastStatusDate, errorMessage=:errorMessage,
> errorDetails=:errorDetails when not matched then insert (id,Status,
> lastStatusDate, errorMessage, errorDetails) values
> (:id,:status,:lastStatusDate,:errorMessage,:errorDetails)";
> Can you please let me know how to resolve it?

Easy -- just don't use merge with Postgres, as it doesn't support MERGE
yet.  There's work ongoing to support it, but it will appear in Postgres
11 at the earliest.

There exists a nonstandard command INSERT ON CONFLICT DO UPDATE which
would probably be useful.

Álvaro Herrera      
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

Reply via email to