Kathey Marsden wrote:

> Kathey Marsden wrote:
> 
>> Kathey Marsden wrote:
>>
>>>>
>>> A few questions/concerns  on this issue:
>>> 1)  CORRECT TRIGGER DEFINITION:
>>
>>
>>
> I think this is it.  To update the timestamp when info is updated we do
> this:

> 0 rows inserted/updated/deleted
> ij> CREATE TRIGGER UPDATE_TEST
>  AFTER UPDATE ON TEST
>  REFERENCING OLD AS OLD
>  FOR EACH ROW MODE DB2SQL
>  UPDATE TEST SET TIMESTAMP = CURRENT_TIMESTAMP WHERE
>  TESTID = OLD.TESTID AND INFO != OLD.INFO ;
> 0 rows inserted/updated/deleted

The trigger can also be defined to only fire on update of certain
columns, e.g.

AFTER UPDATE ON TEST(INFO)

Then I think this would lead to a simpler action statement of

UPDATE TEST SET TIMESTAMP = CURRENT_TIMESTAMP WHERE TESTID = OLD.TESTID

A statement trigger might be best in this case, would result in a single
update statement rather than N.

Dan.




Reply via email to