Re: PL/SQL: To determine which field was update

From: Benson Butt <bbutt_at_v-wave.com>
Date: 1997/08/07
Message-ID: <5se7bj$kvv5_at_crash.videotron.ab.ca>#1/1


 Yup, that is true. The psedo code is just to illustrate the concept.

Chris Hamilton wrote in article <33E9CAB4.3B04_at_usace.army.mil>...

>Benson Butt wrote:
>>
>> You can do a comparison using :old and :new.
>> i.e.
>> if :old.fld1 != :new.fld2
>> -- do something since the field is updated
>> endif
>
>You may wish to use the nvl() function to make sure nulls are compared
>properly (since null doesn't equal anything, but it doesn't not equal
>anything either).
>
>For instance,
>
>For varchar2:
>
>if nvl(:old.field1,' ') != nvl(:new.field2,' ') then
> blah-blah;
>end if;
>
>For numeric:
>
>if nvl(:old.field1,0) != nvl(:new.field2,0) then
> blah-blah;
>end if;
>
>For date:
>
>if nvl(:old.field1,'01-jan-01') != nvl(:new.field2,'01-jan-01') then
> blah-blah;
>end if;
>
>Chris
>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>Chris Hamilton - Oracle Database Admin.
>AVANCO Intl. / US Army Corps of Engineers
>Christopher.H.Hamilton_at_usace.army.mil
>http://www.serve.com/cowpb/chamilton.html
Received on Thu Aug 07 1997 - 00:00:00 CEST

Original text of this message