I have a table like the following in oracle:
SELECT * FROM ESTUDIANTES;
ID NOMBRE EDAD
-- ------ ----
1 Pepe 23
2 Maria 35
...
Can I somehow find out what date the inserts were made in that table?
I have a table like the following in oracle:
SELECT * FROM ESTUDIANTES;
ID NOMBRE EDAD
-- ------ ----
1 Pepe 23
2 Maria 35
...
Can I somehow find out what date the inserts were made in that table?
The answer is NO . If you want the INSERT date, you have to add a date column to the table definition for that purpose and maintain this information yourself.
In another answer it is suggested to use the special pseudo-column
ORA_ROW_SCN
combined with theSCN_TO_TIMESTAMP
. The idea is interesting, but it has 2 major problems:ORA_ROW_SCN
returns a number that is the system change number (SCN), which represents the last time the record changed . In other words, every timeUPDATE
a record is modified,ORA_ROW_SCN
it changes, so that the information of when the occurred is lostINSERT
.SCN_TO_TIMESTAMP
to convert the valueORA_ROWSCN
to a date won't work and will give you an error ( no snapshot found based on specified time ). This is because the date information is kept in Oracle's REDO, which is a file that is continually rewritten, and does not store the information permanently.For these 2 reasons, avoid using
ORA_ROWSCN
+SCN_TO_TIMESTAMP
, because even if it seems to work at first glance, if you unUPDATE
to the records or wait long enough, you will see that it will no longer work.Use ORA_ROWSCN