Re: Trigger Question

From: Basha & Michel DURAND <durand_at_fast.net>
Date: 1997/12/30
Message-ID: <34A9207F.C9D504F_at_fast.net>#1/1


Charles,

as for the NULL the good old function NVL(column, anyvalue) may help, as for the multiple column update within the same record, I would do only one insert at the end of the IF THEN's. I don't know what your record_change() is made of, but you might consider an overloaded procedure if you dont have too many fields.

Michel

Charles Dunaway wrote:
>
> I want to create a trigger that will scan for several columns and if
> they are updated, write the old and new values to an audit table. I am
> trying a trigger AFTER UPDATE FOR EACH ROW that goes something like
> this:
> if :old.name <> :new.name then
> // procedure that adds user ID, sysdate and checks for INSERT vs.
> UPDATE
> record_change( :old.empid, "NAME", :old.name, :new.name);
> end if;
> // repeated several times for various other fields
>
> This appears to work sporadically, but not consistently, for example, if
> the new value is a null string nothing happens. If several columns are
> updated at once, not all seem to get audited.
>
> Is there something I'm missing here? (Obviously!) Do I need a separate
> trigger for each column I want to audit?
  Received on Tue Dec 30 1997 - 00:00:00 CET

Original text of this message