Subject Re: Transactional Commands in Stored procedures.
Author Alexander V.Nevsky
--- In firebird-support@yahoogroups.com, Tim Ledgerwood <tim@s...>
wrote:
> At 06:26 PM 21/07/2003 +0200, you wrote:
> Its a very useful thing. In Sybase, you can have a stored procedure
that
> calls other stored procedures. (As you can in many DBMSs). So what
you can
> do is something like this :
>
> DECLARE PROCEDURE MYPROCEDURE
> (
> INPUT VARIABLES
> )
> AS
> BEGIN
> BEGIN TRANSACTION
> INSERT INTO THISTABLE
> EXECUTE THATPROCEDURE
> EXECUTE ANOTHERPROCEDURE
> DO SOMETHINGELSE
> COMMIT TRANSACTION
>
> EXCEPT
> BEGIN
> ROLLBACK
> INSERT INTO ERRORLOGTABLE
> (X, Y, Z)
> END
> END


Tim, when nothing helps, perhaps it's time to RTFM ;) BTW, this is
related to multiple Mahesh's questions too.

DECLARE PROCEDURE MYPROCEDURE
(
INPUT VARIABLES
)
AS
BEGIN
INSERT INTO THISTABLE
EXECUTE THATPROCEDURE
EXECUTE ANOTHERPROCEDURE
DO SOMETHINGELSE

When Any Do /*You can handle particular exceptions differently*/
INSERT INTO ERRORLOGTABLE (X, Y, Z)
END

Begin..End blocks and Suspends have influence on exception handling.

Best regards, Alexander.