Q

Row affected by last DML operation

How can I find the row of a table that was affected by the 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

Dig deeper on Oracle database design and architecture

Pro+

Features

Enjoy the benefits of Pro+ membership, learn more and join.

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.

0 comments

Oldest 

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

-ADS BY GOOGLE

SearchDataManagement

SearchBusinessAnalytics

SearchSAP

SearchSQLServer

TheServerSide

SearchDataCenter

SearchContentManagement

SearchFinancialApplications

Close