Jacob Schoen
Jacob Schoen

Reputation: 14212

Custom oracle exceptions through JDBC

In a stored procedure I have used to;

raise_application_error (-20010, 'My Message');

to raise a custom error in a certain situation. What I am trying to do is when I make my JDBC call from java, to be able to identify this error as not just being a SQLException so that I can handle it differently. I though I could identify it by the errorCode, but that seems to always be 17062 and not -20010.

Is there another way to do this, or am I missing something?

Upvotes: 2

Views: 583

Answers (1)

Vincent Malgrat
Vincent Malgrat

Reputation: 67792

you should get 20010 as your errorCode. the ORA-17062 is an error for invalid ref cursors. Are you sure the procedure you are calling throws the custom error ?

Upvotes: 2

Related Questions