When I trigger submit on a page, a process is executed that calls a store procedure.
If I use apex_error.add_error to show the errors, where should I put them, inside the store procedure or inside the page process?
Or how else could I show the errors?
Vinish Kapoor
You can return the default or custom error messages from the stored procedure, and if any error returns, then show it using the apex_error.add_error procedure in the process in Oracle Apex.
Check the following example:
Return one more parameter as out parameter from your procedure, for example:
The above procedure will handle the error in the exception section and return the error message using the o_error_message out parameter.
Now you have to catch this error message in the Process in Oracle Apex. Below is an example of the process code:
Please test and let me know if any issues.
IBRO
Dear Vinish how to show the error message if I'm using stored procedure and I already handled the Exceptions with it with out submitting the page.
My problem is I'm not submitting the page to execute the process I'm using the dynamic action to insert into table using stored procedure
Vinish Kapoor
From the PL/SQL dynamic action set the returned error message value to a hidden page item using the apex_util.set_session_state method. And write a dynamic action on that hidden item for change event and show the error message using the JavaScript alert.
IBRO
I will try and let you know .
Thanks a lot
Jorge.criv
It worked very well, thanks