Home » RDBMS Server » Server Administration » How to handle the user-defined exception?
How to handle the user-defined exception? [message #371840] Tue, 12 December 2000 22:27 Go to next message
wyshuai
Messages: 13
Registered: December 2000
Junior Member
I write the following code in a tirgger;

create or replace trigger tr_1
before update
on t_1
for each row
declare
update_error exception;
begin
raise update_error;
exception
when update_error
then raise_application_error(-20001,'unable to
update the table outside the system!';
end;
/
The code I wrote is processed succesfully .
But when i update the table t_1 in the sql*plus,The erros appears:
ora-20001 'unable to
update the table outside the system!'
ora-*****The error accured at line 7
ora-*****The trigger encountered a error?
Can you tell me the reason? And how can i define my own error code? Thank you!
Re: How to handle the user-defined exception? [message #371842 is a reply to message #371840] Wed, 13 December 2000 02:34 Go to previous message
John R
Messages: 156
Registered: March 2000
Senior Member
I'm not entirely sure what you're asking.

In the example you give, you have defined your own error code (20001 in this case), you have successfully raised this error, and it has told you why it was raised. (In this case it was raised because the only functional line of code in the trigger is 'RAISE update_error;', which will raise the user defined exception update error).
Previous Topic: List the Desc of all database tables in the Schema
Next Topic: to find the first day of the month
Goto Forum:
  


Current Time: Sun Dec 22 20:57:24 CST 2024