cancel
Showing results for 
Search instead for 
Did you mean: 

Rollback not working in HANA XSA

former_member597564
Participant
0 Kudos

PROCEDURE ".."( ) LANGUAGE SQLSCRIPT SQL SECURITY INVOKER --DEFAULT SCHEMA <default_schema_name> --READS SQL DATA AS BEGIN /************************************* Write your procedure logic *************************************/ DECLARE EXIT HANDLER FOR SQLEXCEPTION SELECT ::SQL_ERROR_CODE, ::SQL_ERROR_MESSAGE FROM "...::DUMMY";

INSERT INTO "TABLE" VALUES( , , , );

INSERT INTO "TABLE" VALUES( , , , );

ROLLBACK;

END

I can see the exception thrown "Unique constraint violated

But ROLLBACK is not happening data is inserted by first INSERT statement

Accepted Solutions (1)

Accepted Solutions (1)

pfefferf
Active Contributor

Your rollback is not working, because the Rollback statement is not reached in your coding.

You have to do the rollback handling when the exit handler is executed.

...
BEGIN 
  DECLARE EXIT HANDLER FOR SQLEXCEPTION 
    begin
      ROLLBACK;
      SELECT ::SQL_ERROR_CODE, ::SQL_ERROR_MESSAGE FROM dummy;
    end;
  INSERT INTO "TABLE" VALUES( , , , );
  INSERT INTO "TABLE" VALUES( , , , );
END
former_member597564
Participant
0 Kudos

Hi Florian,

What if there are another different table.

Does it rollback all the insertion of data into multiple tables?

Regards,

Nagendra

pfefferf
Active Contributor
0 Kudos

Please have a look to the documentation. It answers your question already.

Answers (0)