Databases
cancel
Showing results for 
Search instead for 
Did you mean: 

How to know the oracle record change time

Printaporn_1
Esteemed Contributor

How to know the oracle record change time

Hi,
if I want to list the records in a table that was modified 30 minutes ago ( I want to know that every 30 minutes which records was modified) , how can I do in oracle , does any hidden column that have modification timestamp for that row.
If they don't have how can I know , or what else method can be use , snapshot /replication ?

thanks in advance,
enjoy any little thing in my life
3 REPLIES
A. Clay Stephenson
Acclaimed Contributor

Re: How to know the oracle record change time

By far the easiest method would be to a datetime column to the table with an update/insert trigger to load the time.
If it ain't broke, I can fix that.
Deepak Extross
Honored Contributor

Re: How to know the oracle record change time

How about adding a 'serial' field?
You'll have to store the max. serial number found after each run, so that the next time around, you can query for all records with serial_no > this value.

A word of caution, though - this may not work well if records are deleted frequently, because the Database Engine may allot a 'freed' serial number to a freshly added row. This is an issue in Informix - not too sure how Oracle behaves.


Bruce Mulder
Occasional Visitor

Re: How to know the oracle record change time

Deepak's idea will work out very well if you use a non-recycling sequence as your counter. Be prepared for "holes" in your serial number as rows are deleted and your database is recycled.

IMHO, Clay's solution may prove to be of greater benefit as important auditing information is gathered and affixed permenently to the row. With a serial number, you only have creation order preserved once the max.ser_no is overwritten.