Removing duplicate records by using Oracle's ROWID

Explains how a table of records can be de-duped by using ROWID column in Oracle.

A table of records can be deduped by using ROWID column in Oracle. A ROWID is a unique location of a row in the database that never changes for the life of that row. By using ROWID, Oracle Optimizer would select the fastest path, which is a direct route to a single row of data. The following code selects the most current record for every duplicate pair of col1 and col2.

		
Select col1,col2,col3,col4 from TableName where
ROWID in (select max(ROWID) from TableName
group by col1,col2)

For More Information


This was first published in May 2001

Dig deeper on Oracle and SQL

Pro+

Features

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

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