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

Home -> Community -> Usenet -> c.d.o.server -> Re: Why don't this trigger work? (Ora 9i)

Re: Why don't this trigger work? (Ora 9i)

From: Bricklen <bricklen_at_shaw.ca>
Date: Tue, 12 Feb 2002 16:30:02 GMT
Message-ID: <3C6942AB.E982483A@shaw.ca>


Is it possible to use two WHEN clauses in a single trigger? No idea, interesting if so. If not, then maybe try a simple IF THEN clause?

create or replace trigger xxx spalte1, spalte2 ON tabelle referencing old as old new as new
for each row
begin
if :new.spaltel != :old.spaltel THEN
INSERT ...
ElSIF :new.spalte2 != :old.spalte2 THEN
INSERT ...
ELSE <whatever>;
END;
/
show errors

after update of

odette wrote:
>
> If I try to compile this trigger with the sql*plus worksheet I get a
> message: "Trigger created with compiler error". But if I execute "show
> errors" I get the message: "no errors"! Also if I execute "SELECT *
> FROM user_errors" I get no error related to my script.
>
> What is wrong with this sql code?
>
> CREATE OR REPLACE TRIGGER "xxx"."ON_UPDATE" AFTER
> UPDATE of spalte1, spalte2 ON "tabelle" referencing old as old new as
> new
> FOR EACH ROW
> when ( new.spalte1 != old.spalte1)
> begin
> insert into tabelle_his
> (his_user, his_action, his_tb, his_id, his_att, his_alt, his_neu,
> his_time)
> values
> (user, 'aendern', 'tabelle', :old.id, 'Attribut', :old.spalte1,
> :new.spalte1, sysdate);
> END;
> when ( new.spalte2!= old.spalte2)
> begin
> insert into historie
> (his_user, his_action, his_tb, his_id, his_att, his_alt, his_neu,
> his_time)values
> (user, 'aendern', 'tabelle', :old.id, 'Attribut', :old.spalte2,
> :new.spalte2, sysdate);
> END;
Received on Tue Feb 12 2002 - 10:30:02 CST

Original text of this message

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