I am raising some application errors from PL/SQL procedures. I am setting some messages for instance,
RAISE_APPLICATION_ERROR(-20001, 'message');
Is there any way, I can display 'message'
in exception section in catch block of java program from which I called this procedure?
If you're doing
catch (Exception e)
,message
should be available frome.getMessage()
.If you're doing
catch (SQLException e)
(or whatever the exception type is for your data access package)message
should still be available frome.getMessage()
. Additionally, the-20001
should come through ine.getErrorCode()
. Note that it may come through as the absolute value (20001
as opposed to-20001
); you'll have to experiment.I think this post will help you out: Error catching
If your not using Hibernate you might need to change the error type.