Author
shabbir ( Go4Expert Founder )
Shabbir is a developer in the field of Applications, web as well as database designing and is devoted to the optimization and usability of the code. He maintains Programming forum and is a C++ addict.
Recent Articles
- Oracle Nested Tables and Varrays, Started by kidas in Oracle
- Avoiding TOO_MANY_ROWS Error In Oracle, Started by pradeep in Oracle
- Datatypes in Oracle, Started by Sanskruti in Oracle
- SQL*Plus, Started by Sanskruti in Oracle
- Exception Handling, Started by Sanskruti in Oracle
Similar Articles
- Audit Trail in Oracle, Started by shabbir in Oracle
- Uninstalling Oracle 8 Personal Database, Started by shabbir in Oracle
Now in Oracle you can delete the duplicate entries by just executing a simple SQL because Oracle stores an index to each row in a table known as ROWID
Code: SQL
CREATE TABLE duptest
( Id varchar(5),
nonid varchar(5));
Insert some date to simulate duplicates
Code: SQL
INSERT INTO duptest VALUES('1','a');
Code: SQL
INSERT INTO duptest VALUES('2','b');
Code: SQL
DELETE FROM duptest WHERE rowid NOT IN (SELECT max(rowid) FROM duptest GROUP BY id);
The the subquery returns one record for the dupliacte ID's and I delete all of them that are not in the subquery and that deletes all the dupliacte rows from the database.













Linear Mode

