On Oct 6, 2005, at 2:55 AM, padmanabha konkodi wrote:

i have written function in which while executing it may throw error.
if the error thrown i want rollback the transaction if not i want commit.

how can i achive this task.

how can catch exception thrown in the function


The function itself cannot start or rollback a transaction (functions are always executed in the context of a transaction). But I think you can use a SAVEPOINT to accomplish your request:

http://www.postgresql.org/docs/8.0/interactive/sql-savepoint.html

And see this page on how to catch exceptions:

http://www.postgresql.org/docs/8.0/interactive/plpgsql-control- structures.html#PLPGSQL-ERROR-TRAPPING


John DeSoi, Ph.D.
http://pgedit.com/
Power Tools for PostgreSQL


---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
      subscribe-nomail command to [EMAIL PROTECTED] so that your
      message can get through to the mailing list cleanly

Reply via email to