Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: simple trigger problem
you might like to commit the insert.
regards,
nitin.
<yliu_at_creighton.edu> wrote in message
news:Pine.HPP.3.95.990722162533.24591A-100000_at_penguin.creighton.edu...
> Hi,
>
> I was wondering if somebody please help me with the following creating
> trigger problem: I have a table called yongge (name varchar2(50), age
> number(3)). I want to validate the age field when I insert/update on the
> table. Therefore, I created a trigger as follows:
>
> create or replace trigger check_age
> before insert or update on yongge
> for each row
> declare
> low_age constant number :=0;
> hi_age constant number :=200;
> begin
> if (:new.age > hi_age or :new.age < low_age) then
> insert into error_log values(sysdate, 'Age out of range');
> raise_application_error(-20500, 'Age out of range');
> end if;
> end;
> /
>
> The above trigger was created without error. However, every time when I
> try to insert a age value which is out of range, I could not find my
> corresponding entry in my error_log table.
>
> Any help would be appreciated.
>
> Best regards,
> yliu_at_creighton.edu
>
Received on Fri Jul 23 1999 - 13:20:15 CDT
![]() |
![]() |