Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> simple trigger problem

simple trigger problem

From: <yliu_at_creighton.edu>
Date: Thu, 22 Jul 1999 16:31:56 -0500
Message-ID: <Pine.HPP.3.95.990722162533.24591A-100000@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 Thu Jul 22 1999 - 16:31:56 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US