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

Home -> Community -> Mailing Lists -> Oracle-L -> Re: Database Trigger

Re: Database Trigger

From: Ramamohan B N <ramamohan.bn_at_tatainfotech.com>
Date: Thu, 14 Dec 2000 12:59:56 +0530
Message-Id: <10709.124529@fatcity.com>


Hi Ravindra,

You can do it using IF construct:

CREATE or REPLACE TRIGGER trg_alt_his_update AFTER INSERT or UPDATE on alt
FOR EACH ROW
   BEGIN

       IF :new.status <> 6 THEN
           insert into alt_his
           values(:new.id,:new.status,:new.not,:new.update_time,
           :new.sub) ;
       END IF;

   END; Regards,
Mohan

Ravindra Basavaraja wrote:
>
> I am trying to write a database trigger that should fire on update of a
> table
> and when the new value in a column is not equal to 6.
>
> CREATE or REPLACE TRIGGER trg_alt_his_update
> AFTER INSERT or UPDATE on alt
> FOR EACH ROW
> BEGIN
> insert into alt_his
> values(:new.id,:new.status,:new.not,:new.update_time,
> :new.sub) ;
> END;
>
> I want this trigger to fire only when the new value of status is not equal
> to 6.
> Where can i put in the WHEN clause.
>
> It doesn't with
> insert into alt_his
> values(:new.id,:new.status,:new.not,:new.update_time,
> :new.sub) WHEN :new.status NOT IN 6;
> i get compilation error.
>
> can anyone tell me how to get it work.
Received on Thu Dec 14 2000 - 01:29:56 CST

Original text of this message

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