Re: A question about Trigger? HELP!!!
Date: Wed, 10 Jun 1998 16:22:33 +0100
Message-ID: <6lm4q4$mud_at_news.Informatik.Uni-Oldenburg.DE>
violin wrote:
> Hello,
> I want to create a trigger for log scott.emp,
> and log table name is scott.emplog
>
> The purpose is
>
> Before insert into emp ,
> insert into emplog (empno_new,ename_new,job_new,date,user) values
> (:new.empno,:new.ename,:new.job,SYSDATE,user);
>
> Before update or delete emp,
> insert into emplog (empno_old,ename_old,job_old,date,user) values
> (:old.empno,:old.ename,:old.job,SYSDATE,user);
>
> How could I edit my trigger script for these purpose?
> Could any give me some advice???
You need this in Forms or in the database? That are different ways to realize...
In Forms create a block for emp and place the SQL-statements in the POST-UPDATE or POST-INSERT triggers.
In the database use a statement like
CREATE TRIGGER scott.emp_log_upd BEFORE INSERT
ON emp
BEGIN
here comes your statement!
END;
CREATE TRIGGER scott.emp_log_upd BEFORE UPDATE
ON emp
BEGIN
here comes your statement!
END;
It's hard to say wich way executes faster, but triggers are always slow.
Another Tip: Read the SQL*Plus docu, especially the "CREATE TRIGGER" - command.
Marcel Received on Wed Jun 10 1998 - 17:22:33 CEST