Skip to Content
avatar image
Former Member

Are MERGE statements in stored procedures supported by SAP HANA

I am in process of migrating database objects from SQL SERVER to SAP HANA. I have observed that HANA SQL documentation supports MERGE INTO syntax. However, in one of the procedures where I am trying to use MERGE statement inside an autonomous transaction, I am getting a SQL syntax error.

My statement looks like this :

BEGIN AUTONOMOUS TRANSACTION

MERGE INTO <schema>.<table> USING(SELECT statement inside) ON (criteria) WHEN MATCHED THEN update set <statements> WHEN NOT MATCHED THEN INSERT <STATEMENTS>;

COMMIT;

END;

The error looks like "SAP DBTech JDBC: [257]: sql syntax error: incorrect syntax near "INTO": line 6 col 15 (at pos 422)"

Also, what is the equivalent of XACT_STATE() function in HANA.

TIA

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer