Unanswered: How to display an error message generated by a trigger
I need to prevent that a column to be updated and display an error message. The table is accesed either Developer Forms or Java Programs. There are more than 100 programs thah access the table so we don't want to modify them, instead we want to use a database trigger.
We kwow how to write the trigger, for example
create or replace trigger trigger_bef_upd
before update of myField on myTable
for each row
if :new.myField > 1000 then raise myException ;
when miExcepcion then
raise_application_error(-20999,'You cannot update this field');
But we don´t know hoy to the error message could be displayed without modifying the programs
I am not sure, if this helps at all,
but java Developers will get SQL exceptions through the use
of the package "java.sql.SQLException".
If they are at least moderately good at programming for Databases, I am sure
they are catching this type of errors and as far as I understand it (I'm not a developer myself) a failed statement because of a trigger would also be returned by the above class package, which throws all kinds of issues occuring during a JDBC connection...
However, I have no idea in what format they would get it, probably depends both on your trigger exception output and their exception handling.