Reputation: 21
I am using Oracle Apex 19.2. I need to create a Form Page with many fields and many validations.
Instead of creating one Validation Routine for every field and check I want to put them all into one PL/SQL procedure and create Process Routine in APEX. Inside that pl/sql procedure I would perform all necessary checks and use apex_error.add_error
to add all errors into stack.
If there is at least one error I want to break procedure execution and show it on the page. The problem is that the procedure completes always successfully so no error is displayed. I tried raise_application_error but my custom error is also visible on error page.
The same applies when rising apex_application.e_stop_apex_engine
- apart from my custom validations there is also ORA-20876
error from apex_application.stop_apex_engine
.
Is there any way I could either break procedure execution without raising an error or ignore somehow the error I raise to break it?
Upvotes: 0
Views: 4132
Reputation: 21
Problem solved.
I defined my PL/SQL procedure as an APEX Process routine. Instead of that, I should have done it as an APEX Validation. It looks like APEX carries out all validations and then, even if they all went ok, it checks error stack and does not proceed with processing if there is any error. Below steps how to achieve it.
your_plsql_package.your_procedure;
return true;
And that is it. Instead of having dozens validations on the page you can have one procedure to rule them all :) However, it could be more developer friendly.
Upvotes: 2