Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Why don't this trigger work? (Ora 9i)
Hi Odette,
what version?
AFAIK (upto Oracle 8i), the whens in your code should be replaced by the proper control structure (IF .. THEN ... ELSE ... END IF;) and the begins .. ends also don't seem to be in the right place.
I suppose a look into the PL/SQL Doku or a PL/SQL book (Feuerstein?) would be helpful.
:-)
Dieter
"odette" <odette.h_at_gmx.de> schrieb im Newsbeitrag
news:66e0618e.0202120646.64546bd0_at_posting.google.com...
> 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 - 09:21:03 CST