Thread: Ending transaction inside stored function

Ending transaction inside stored function

From
Date:
This was probably asked n-times but still:

Is there any way to end (commit/rollback) a transaction inside a stored
function?

(The reason why it is good to commit/rollback in a stored procedure is that
in C/S environment it is not uncommon to have a dead client holding
locks(unfinished transactions) in the database. For web applications running
3 tires it is not such an issue actually.
Ending transactions in the database stored procedures engine solves this
issue: engine runs in the database itself and there is little probability
that engine goes down leaving uncleared locks in the database.
In fact DB stored procedures engine can be used as a middle-tire in C/S
environment, eliminating need for another kinds of middle tires)


Thank you in advance,
Laimis

Re: Ending transaction inside stored function

From
Bruno Wolff III
Date:
On Wed, Jan 21, 2004 at 10:49:25 -0000,
  lnd@hnit.is wrote:
> This was probably asked n-times but still:

Yes, see the archives.

> Is there any way to end (commit/rollback) a transaction inside a stored
> function?

Currently this isn't possible.

Re: Ending transaction inside stored function

From
"Chris Travers"
Date:
> Is there any way to end (commit/rollback) a transaction inside a stored
> function?

Currently not, but you can RAISE EXCEPTION to terminate the containing
transaction.  This will essentially rollback the transaction when it hits
the COMMIT statement (or implied version).

Best Wishes,
Chris Travers