Skip to content

Request synchronization error with SUSPEND inside two exceptions handling blocks (specific and common) [CORE3410] #1323

Open
@firebird-automations

Description

@firebird-automations

Submitted by: Vladimir Arkhipov (arkinform)

Votes: 2

The following simple procedure works fine and returns 'Error3'.

create or alter procedure TEST
returns
(
error_text varchar(1024)
)
as
begin
in autonomous transaction do
begin
exception error 'Error1';

when exception error do
begin
  error\_text = 'Error2';
  exception;
end

end

when exception error do
begin
error_text = 'Error3';
suspend;
end
end

But if I add extra handling "when any do" to the end of procedure, then request synchronization error occurs.

create or alter procedure TEST
returns
(
error_text varchar(1024)
)
as
begin
in autonomous transaction do
begin
exception error 'Error1';

when exception error do
begin
  error\_text = 'Error2';
  exception;
end

end

when exception error do
begin
error_text = 'Error3';
suspend;
end

when any do
begin
error_text = 'Error4';
suspend;
end
end

May be usage of exception handling in autonomous transaction block is wrong in principle?!
But in some cases it is needed for rollback all autonomous actions and receive information about state from transactional context variables, for example.