This content has been marked as final. Show 4 replies
Do you need the "raise;"
yes, raise is needed. otherwise APEX thinks the procedure completed successfully.
I'm just suggesting that's perhaps why you don't see the "success_message", since you've propagated the exception.
Without knowing context of what you're trying to attempt, it's hard to suggest the best course of action.
apex_application.g_print_success_message will/should only be used if your processes/page completes successfully, so it can't really be used for this use case. BTW, that global variable isn't really documented and not supported by us. If you want to raise an exception in your process which should stop execution of your process/page accept, I would suggest to use RAISE_APPLICATION_ERROR instead.
If you don't like that the user sees the ORA-20000 in your error message, I would suggest to have a look at our error handling function example at http://docs.oracle.com/cd/E37097_01/doc/doc.42/e35127/apex_error.htm#CABDJBGJ (the code to look for is apex_error.get_first_ora_error_text). Also have a look at my blog posting at
declare e_exception exception; begin raise e_exception; exception when e_exception then raise_application_error(-20000, 'This custom account is not active!'); end;
http://www.inside-oracle-apex.com/apex-4-1-error-handling-improvements-part-1/ and http://www.inside-oracle-apex.com/apex-4-1-error-handling-improvements-part-2/ how to use it and how to change your process so that the error is displayed inline.
My Blog: http://www.inside-oracle-apex.com
APEX Plug-Ins: http://apex.oracle.com/plugins