Row affected by last DML operation
How can I find the row of a table that was affected by the last DML operation?
The answer all depends on your version. One method that is version-independent is to add a new column to the table called DML_TIME. Then create a trigger which sets the DML_TIME column to SYSDATE on every INSERT, UPDATE or DELETE. Obviously, this method requires the trigger to be set up before the fact.
In Oracle 8i and higher, you can use Log Miner to mine the archived redo logs looking for this information.
In Oracle 10g, you can use the Flashback Versions Query to see the last DML against the table, provided that DML operation occurred less time ago than the number of seconds specified by the UNDO_RETENTION initialization parameter.
This was first published in July 2006