I have triggers that allow my views to be used for inserts or updates. I have built exceptions into them that catch errors caused by the user. I am looking for a way to display the error messages in a user friendly way. The triggers/views are being used in a data load wizard in APEX 4.2.2.
Example: for any stored procedure, function or trigger a user uploads data that is not acceptable
main_lbl_format exception; -- is declared
raise main_lbl_format; -- is called when error is detected
exception
when main_lbl_format then
raise_application_error(-20001,'ERROR IN MAIN_LABEL',TRUE ); --exception is handled by raising application error
results in this being displayed:
ORA-20001: ERROR IN MAIN_LABEL ORA-06512: at "TRIGGER_NAME", line 33 ORA-06510: PL/SQL: unhandled user-defined exception ORA-04088: error during execution of trigger 'TRIGGER_NAME'
It would be nice to just show 'ERROR IN MAIN_LABEL' instead of everything else.
Because of how APEX data load wizards work apex validations before the trigger has a chance to run is not possible. APEX also does not recognize using DBMS_OUTPUT.PUT_LINE instead of raise_application_error as an error.
This is a somewhat vague question but any thoughts/ideas you have are welcome.