Subject | Re: [ib-support] Transactions in stored procedures |
---|---|
Author | Jason Wharton |
Post date | 2002-07-05T18:37:49Z |
Transaction are controlled strictly from the client.
But, what you should know about InterBase/Firebird is when you call a stored
procedure it gets its own unit of work that will be totally "unwound" or
cancelled if an exception is raised at any point during the execution of the
stored procedure, or other stored procedures or triggers that get executed
as well. Because of this, there is no need for nested transactions.
Let me put it another way, executing a stored procedure is like having it
run in its own nested transaction. Either it succeeds and all the work it
performed is now a part of the clients transaction or it fails (at any
point) and all the work it performed is cancelled and not a part of the
client transaction.
So, the moral to the story is, whatever you need nested transactions for
just put all the work in a single stored proc and you have your nested
transaction.
HTH,
Jason Wharton
CPS - Mesa AZ
http://www.ibobjects.com
"Matteo Giacomazzi" <matteo.giacomazzi@...> wrote in message
news:2618099094.20020705201201@......
But, what you should know about InterBase/Firebird is when you call a stored
procedure it gets its own unit of work that will be totally "unwound" or
cancelled if an exception is raised at any point during the execution of the
stored procedure, or other stored procedures or triggers that get executed
as well. Because of this, there is no need for nested transactions.
Let me put it another way, executing a stored procedure is like having it
run in its own nested transaction. Either it succeeds and all the work it
performed is now a part of the clients transaction or it fails (at any
point) and all the work it performed is cancelled and not a part of the
client transaction.
So, the moral to the story is, whatever you need nested transactions for
just put all the work in a single stored proc and you have your nested
transaction.
HTH,
Jason Wharton
CPS - Mesa AZ
http://www.ibobjects.com
"Matteo Giacomazzi" <matteo.giacomazzi@...> wrote in message
news:2618099094.20020705201201@......
> Hi all,
>
> I noticed I cannot use
> SET TRANSACTION
> inside a stored procedure.
> So, how does transactions work in a stored procedure environment?
> Any link to the manual to better understand it?
>
> Thank you in advance!
>
> Kind regards,
> --
> Matteo
>
> mailto:matteo.giacomazzi@...
> ICQ# 24075529