db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thomas Hill <Thomas.K.H...@t-online.de>
Subject Re: after insert trigger calling a procedure - how can I retrieve NEW values inside the procedure?
Date Mon, 24 Aug 2009 19:48:39 GMT

thanks for your support and further insight into how derby works which you have
been providing in your answers. 

So if I understand correctly: 
(1) With the lack of a possibility to change the content of a transition
variable in an After Insert trigger, 
(2) the lack of insert, update or delete in Before Insert triggers and 
(3) with the restriction of check constraints needing to be deterministic, 

it looks like 
(1) defining a default value on the colum (to ensure something is put there even
if the user does not give a value on the insert itself) and
(2) a SECOND after insert trigger which includes an Update statement seems to be
the only option to implement an audit function if one wants to ensure that a
column 'CreatedBy' on a table shows the login of the person who has inserted the
row (regardless of what that person might or might not have included on the
insert statement itself). (Note: a second after insert trigger, because the
'other' after insert trigger which executed a derby procedure is already needed
to implement the audit function as such).

I still need to implement this second after insert trigger to check details, but
I would assume the update statement included will then itself fire the update
trigger I defined for auditing changes on my table and I will then have audit
(1) showing the initially inserted value on the columns and 
(2) audit records showing the 'old' value fom the initial inserrt and records
from after the update coming fom the second trigger - whereas I would have only
had one entry in case I could have overwritten transition variable content in
the first place with whatever would have been stored there prior to this being
written back to the data base.


View raw message