Subject Transaction inside stored procedures
Author clementdoss
Hi,

Well I searched the docs but I have not found how to start a
transaction inside a stored procedure.

For example:

CREATE PROCEDURE SP_FOO( aID Integer )
begin

SET TRANSACTION READ WRITE WAIT ISOLATION LEVEL READ COMMITED;

DELETE FROM TABLE1 WHERE INT_ID = :aID;
DELETE FROM TABLE2 WHERE INT_ID = :aID;

COMMIT;
END;

Is raising a syntax error. Unknow token: SET


But I would like some more complex error handling. For example,
SP_IMPORTMEMBERS_MNGR will call a few other stored procedure.
Those called procedure will report success or failure. On failure,
the *_MNGR procedure will execute a rollback and report the error to
the application. On Success, a commit will be issued.

SP_IMPORTMEMBERS_MNGR
-Start Transaction
-Result = import partner input file -- This is a stored procedure
-if result<>0 then Goto SomeError
-Result = Validate Partner File -- This is a stored procedure
- if Result<>0 then Goto SomeError

- Commit
Return 0 -- Here I must exit the procedure

-:Somerror
Rollback
Return Result

end;


How can I code this in Firebird?


TIA,
Clément