0

I have a Oracle procedure, that uses PL/SQL SQLCODE function in EXCEPTION section. Now I need to translate that procedure in Java. I found SQLException.getErrorCode function. Are results of SQLCODE and SQLException.getErrorCode the same? Is there right way to get result of SQLCODE function in Java?

1

1 Answer 1

3

They are equivalent.

SQLException.getErrorCode(): Retrieves the vendor-specific exception code. (see here) SQLCODE : In an exception handler, the SQLCODE function returns the numeric code of the exception being handled. (see here)

Suppose if you have a query in which you have specified wrong table name. Then you will get 942 instead of ORA-00942, because getErrorCode() returns int.

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.