on 01-20-2019 9:06 AM
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
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Please have a look to the documentation. It answers your question already.
User | Count |
---|---|
88 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.