2

In Oracle,

WHEN OTHERS THEN
  IF SQLCODE = -31011 THEN

How do I convert the above

IF SQLCODE = -31011 THEN to Postgres as SQLCODE = -31011 is not compatible with Postgres

1

1 Answer 1

2

PostgreSQL uses "standardized" SQLSTATE codes. You should to find most near code in the table https://www.postgresql.org/docs/current/errcodes-appendix.html.

You should to prefer named exception if it is available (not available for custom exceptions):

WHEN OTHERS THEN
  IF SQLSTATE = '22012' THEN 
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.