Problem solve Get help with specific problems with your technologies, process and projects.

Last updated row

Is there any way to find the last updated row in a specific table?

Is there any way to find the last updated row in a specific table?
The answer depends on the database version, which you did not specify. If you are using Oracle 8i or 9i, you can use LogMiner to mine your archived redo logs to determine which row was last updated in the table. In Oracle 10g, you can use a Flashback Versions Query to see the updates to the table.

The above methods can be used after the fact. Before the fact, you can add a column to the table called UPDATE_TIME defined with the DATE datatype. Then create a trigger on the table which sets the UPDATE_TIME column to SYSDATE on any INSERT or UPDATE command on the table. Determining the last updated row is as simple as querying for the row with the MAX(UPDATE_TIME) value. This method does require you to set up the column and trigger beforehand.

Dig Deeper on Oracle database design and architecture

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.