Re: Catch exceptions outside function

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

 



Roberto Grandi wrote:
> I ask for your help cause I can't point out the solution to my problem on PG 8.3
> I would catch an exception outside any function/procedure but directly within script.
> 
> 
> BEGIN;
> 
> -- raise an exception code
> 
> EXCEPTION
> WHEN 'exception_type'
> THEN ROLLBACK;
> 
> COMMIT;
> 
> is it possible with PG 8.3?

That's a bit unclear.
What do you mean by "outside a function but in a script"?
Can you explain in more detail?

The code sample you paste looks like PL/pgSQL.

You cannot commit or roll back in PL/pgSQL.

If you want to undo in case of error whatever happens in the block,
just replace the ROLLBACK with NOOP.

Yours,
Laurenz Albe

-- 
Sent via pgsql-admin mailing list (pgsql-admin@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-admin





[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux