I am using PostgreSQL 9.6.
I have a PROCEDURE in sql server. That makes use of a try catch block. It looks a little bit like the code below:
BEGIN TRANSACTION
BEGIN TRY
--do stuff here
COMMIT TRANSACTION
END TRY
BEGIN CATCH
ROLLBACK TRANSACTION
--do error stuff here
END CATCH
Upon doing some research, It seems like postgres does not make use of try catch. Is there some way to handle this in postgres the same way sql server does?
Callbacks can handle potential errors:
https://www.postgresql.org/docs/9.4/static/ecpg-errors.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With