Is there a way to create a timestamp column in Oracle that automatically stores a timestamp of when the record has changed ?
You can get very close to this by querying ORA_ROWSCN
: http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/pseudocolumns007.htm#sthref825
This is more accurate if you created the table with the ROWDEPENDENCIES option.
It actually logs the commit time for the record ...
drop table tester
/
create table tester (col1 number, col2 timestamp)
rowdependencies
/
insert into tester values (1, systimestamp)
/
(approximate five second pause)
commit
/
select t.ora_rowscn,
SCN_TO_TIMESTAMP(t.ora_rowscn),
t.col1,
t.col2
from tester t
/
ORA_ROWSCN SCN_TO_TIMESTAMP(T.ORA_ROWSCN) COL1 COL2
---------------------- ------------------------------ ---------------------- -------------------------
9104916600628 2009-10-26 09.26.38.000000000 1 2009-10-26 09.26.35.109848000