Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Trigger problem
"Manfred Priller" <manfred.priller_at_holzbau.com> a écrit dans le message news:
3baf1209$1_1_at_news.telnetwork.it...
> I would like to create a trigger which fire before insert a row in the
> table. In the trigger body i will execute some statements. When this
> statements cause a excption then the line should not be inserted in the
> table.
>
> How can i resolve this problem?
>
>
If your statements generate an exception all the insert statement is automatically rollbacked and the row is not inserted. You can use raise_application_exception in the exception block of your trigger to add your message:
create trigger ... before insert on my_table
for each row
begin
<your statements>
exception
when others then
raise_application_exception(-20000, 'insert encountered error '||sqlerrm);end;
-- Have a nice day MichelReceived on Mon Sep 24 2001 - 06:56:27 CDT
![]() |
![]() |