Skip to Main Content

APEX

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Error Messages handling via DB trigger ( trigger after servererror on DB )

620949Feb 11 2008
Hello All
I am newbie in Apex. I was following this thread 2335813 but I cannot get the same result.
Basically I want to use DB system trigger to replace DB Error messages
Here my Trigger

CREATE OR REPLACE TRIGGER tr_errors
AFTER SERVERERROR
ON DATABASE
DECLARE
my_exception EXCEPTION;

BEGIN
IF (ORA_IS_SERVERERROR(0001)) THEN
RAISE my_exception;
END IF;

exception
when my_exception then
RAISE_APPLICATION_ERROR(-20111,'My message');
END ;

Testing on sqlplus:

SQL> insert into user_roles values (6,'TEST_USER','LE');
insert into user_roles values (6,'TEST_USER','LE')
*
ERROR at line 1:
ORA-00604: error occurred at recursive SQL level 1
ORA-20111: My message
ORA-06512: at line 11
ORA-00001: unique constraint (T$UK) violated

Error messages on Apex 3.0.1

ORA-00001: unique constraint (T$UK) violated

I seem that apex is taking the last one. In this case ORA-00001 and not ORA-20111 "My message".
When I create my own DML is doing ok. But I want to avoid to write every DML for each table and deal with locking and Update lossing

Apart of this. Can someone give me an example of your own Update, Insert, Delete procesess, considering locking and update lossing?
I have create my own Update process with optimistic Lock but what about Update lossing I do not have this in my procedure. It will be very usefull see others U/I/D implementations.

Thanks a lot

Marcelo
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 10 2008
Added on Feb 11 2008
0 comments
626 views