Posts

Showing posts from February, 2018

Table modifications

It is an interesting oracle feature.. This feautore allows you to now when a table or a row was modified last time... Each oracle table has a pseudocolum called ora_rowscn , this pseudocolum contains last scn in which a row was modified. So if you need a table last modification date (DML point of view) you can do this.. SQL> select scn_to_timestamp(MAX(ora_rowscn)) FROM OWNER1.TEMP; SCN_TO_TIMESTAMP(MAX(ORA_ROWSCN)) --------------------------------------------------------------------------- 09-FEB-18 03.22.18.000000000 PM This select works selecting the max oracle SCN (System Change Number, each transaction in database generates a new SCN), so the max(scn) is the last DML in the table... Same way you can see when a specific row was modified last time by: SQL> select scn_to_timestamp(ora_rowscn) FROM OWNER1.TEMP where ID=13; SCN_TO_TIMESTAMP(ORA_ROWSCN) --------------------------------------------------------------------------- 08-FEB-18 02.12.14.000000000 PM