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 -> Re: Triggers

Re: Triggers

From: Laurie Heigl <heigl_at_buyitnow.com>
Date: Thu, 02 Sep 1999 17:02:35 -0500
Message-ID: <37CEF3FB.AC2FD107@buyitnow.com>


"William F. O'Neill" wrote:

> Can someone supply me with an example of a Trigger as used on an Oracle
> database, eg. a trigger that would update an audit table, depending on
> whether the action on a table was Update, Delete, or Insert. To clarify,
> if I edit Table_A, I want the trigger to activate, bring up the Audit
> table, and indicate in an Action field that Table_A was just Updated,
> and that a particular field's value changed ->new value, and what the
> old value was. If you have any code that is in anyway similar to my
> requirements, I'd appreciate it. thank you.
> Bill....

create or replace trigger table_a_t1
 before delete or insert or update of bstring on table_b begin
  insert into table_a values('change to b',sysdate); end;

Maybe if you did 'after delete or insert or update' you could insert the old value
from table_b to table_a? I haven't tried it though.

-Laurie Received on Thu Sep 02 1999 - 17:02:35 CDT

Original text of this message

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