<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