Subject Re: [firebird-support] Transactions within a stored procedure
Author Helen Borrie
At 06:04 PM 1/03/2004 -0700, you wrote:
>If Firebird winds up supporting nested transactions for some reason (it
>didn't get that without my
>noticing, did it?), will SP's then be able to at least start/stop their
>own internal transactions?
>It would help make them a bit more fault-tolerant -- if something goes
>wrong, they could just undo
>their local changes, possibly trying something else instead, without
>forcing the main transaction
>calling the SP to do the work.

Woo-hoo, good news for you!! Firebird already has that fault-tolerance
feature. It is called exception-handling, but you can call it "nested
transactions" if you like, since that is the effect of handled exceptions.

create exception woops 'Woops!';
commit;

create procedure ...
as
...
begin
....
begin
if (<something_crazy>) then
exception woops;
<carry on>
....
end
when woops do
begin
<handle the problem>
end
/* once exception is handled, execution resumes at <carry on> if the
handler doesn't decide to call Exit */
end

/heLen