You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Ivan, it's actually the same thing as your prior ticket refers to. Upon exception (of any kind), the current savepoint is undone and the execution is passed to a WHEN handler. BEGIN/END block creates a savepoint around the assignment operator. An EXCEPTION statement is encapsulated within its own savepoint. Try two subsequent updates with an error in the second one and you'll see that only the second one will be undone, because every UPDATE is encapsulated within a savepoint as well.
Submitted by: prenosil (prenosil)
Is related to CORE1953
Exception raised inside simple BEGIN END block caught by WHEN handler does not undo previous actions.
Example script:
CREATE EXCEPTION EX 'Test';
CREATE TABLE TEST(A INTEGER);
INSERT INTO TEST(A) VALUES(1000);
COMMIT;
SELECT * FROM TEST;
A
EXECUTE BLOCK AS
DECLARE VARIABLE I INTEGER;
BEGIN
UPDATE TEST SET A=A+10;
I = ''; .... this will cause conversion error
WHEN ANY DO BEGIN END
END;
SELECT * FROM TEST;
A
Now simply add BEGIN END around command causing exception:
EXECUTE BLOCK AS
DECLARE VARIABLE I INTEGER;
BEGIN
UPDATE TEST SET A=A+10;
BEGIN I = ''; END
WHEN ANY DO BEGIN END
END;
SELECT * FROM TEST;
A
The text was updated successfully, but these errors were encountered: