Subject | Re: [firebird-support] FOR SELECT Commands to skip to the next record without any further processing of code contained between the BEGIN END markers |
---|---|
Author | Paul Vinkenoog |
Post date | 2010-11-21T14:35:23Z |
I wrote:
an exception EX_CONTINUE, and a table T with int column C and three records,
the following block:
execute block returns (s varchar(40))
as
declare i int;
begin
for select c from t into i do
begin
if (s is null) then s = 'a'; else s = s || 'a';
if (s = 'aa') then
begin
s = 'bb';
exception ex_continue;
end
suspend;
when exception ex_continue do begin end
end
end#
returns
a
bba
I.e., the actions performed in the inner block (where the exception isn't
handled) are *not* reversed. Maybe only SQL actions are rolled back? That
would make sense: internally, savepoints are used for this. But it's yet
another thing to be aware of.
Cheers,
Paul Vinkenoog
> You have to be careful though: if there are any inner BEGIN...END blocks inAt least, that's what the documentation (Borland's and ours) says. But given
> the loop and the exception is raised from there, all the actions performed
> in that block will be undone.
an exception EX_CONTINUE, and a table T with int column C and three records,
the following block:
execute block returns (s varchar(40))
as
declare i int;
begin
for select c from t into i do
begin
if (s is null) then s = 'a'; else s = s || 'a';
if (s = 'aa') then
begin
s = 'bb';
exception ex_continue;
end
suspend;
when exception ex_continue do begin end
end
end#
returns
a
bba
I.e., the actions performed in the inner block (where the exception isn't
handled) are *not* reversed. Maybe only SQL actions are rolled back? That
would make sense: internally, savepoints are used for this. But it's yet
another thing to be aware of.
Cheers,
Paul Vinkenoog