db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peri Tarr <peri.t...@gmail.com>
Subject automatically (re)computing last modified time?
Date Mon, 06 Jul 2009 15:00:01 GMT
Hello,

For each update to a row in a particular table, I would like to store the
last user who modified it and the timestamp when it was modified. I had
thought to use Derby's nifty GENERATED ALWAYS for these:

     alter table people add lastModified GENERATED ALWAYS AS
(CURRENT_TIMESTAMP);
     alter table people add lastModifiedBy GENERATED ALWAYS AS
(CURRENT_USER);

Unfortunately, neither CURRENT_TIMESTAMP nor CURRENT_USER are permitted for
automatically generated columns (the documentation says so; I just hadn't
noticed).

Is the intent for people to do this with triggers or some other mechanism?

Thanks very much in advance!
     Peri

Mime
View raw message