db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Knut Anders Hatlen <Knut.Hat...@Sun.COM>
Subject Re: BEFORE UPDATE trigger and REFERENCING old and new values
Date Tue, 02 Feb 2010 08:11:35 GMT
Mamta Satoor <msatoor@gmail.com> writes:

> Hello,
>
> I have a question on "BEFORE UPDATE trigger and REFERENCING old and
> new values".
>
> The Derby Reference Manual under CREATE TRIGGER topics states "Before
> triggers fire before the statement's changes are applied and before
> any constraints have been applied. Before triggers can be either row
> or statement triggers (see Statement versus row triggers).".
>
> Based on the Reference manual blurb above, I thought that if a user
> had a BEFORE UPDATE trigger defined on a (say char(1)) column then,
> old and new values for that column inside the BEFORE trigger will be
> both old value. Not sure how handy that behavior is ie to have both
> old and new value point to the old value, but that is what Derby
> reference manual seems to imply.

Hi Mamta,

The paragraph you quoted does not mention the transition variables OLD
and NEW, so I'm not sure how you came to the conclusion that OLD and NEW
should have the same value in before triggers.

My impression after reading the section about CREATE TRIGGER in the
reference manual, is that OLD and NEW should provide the original values
and post-change values, respectively, regardless of whether or not the
change has actually been made yet. But I didn't find it spelled out
explicitly, so there may be room for improvement in the manual.

-- 
Knut Anders

Mime
View raw message