Re: Commit and Exception Block

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



<soumik.bhattacharjee@xxxxxxx> writes:
> I have a procedure that may encounter an exception. I want to have an exception handling block where exception is to catch is any FK violations.
> Could you please suggest where it's getting missed as part of a transaction.

I think you're confused about the scope of the exception block.
The syntax is

	BEGIN
	  some code here that might throw an exception
	EXCEPTION
	  some WHEN clauses here to catch exceptions from the covered code
	END

You wrote:

>    begin
>     RAISE SQLSTATE 'MYERR';
>       EXCEPTION
>       WHEN ...

So this exception block can *only* trap errors arising from that one
RAISE command, not anything earlier in the procedure.  Seems unlikely
that's what you wanted.

			regards, tom lane






[Index of Archives]     [Postgresql Home]     [Postgresql General]     [Postgresql Performance]     [Postgresql PHP]     [Postgresql Jobs]     [PHP Users]     [PHP Databases]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Databases]     [Yosemite Forum]

  Powered by Linux