@domenico
To delete duplicate records from a table in Oracle, you can use a combination of SQL queries and the ROWID pseudocolumn. Here's a step-by-step guide on how to do it:
1 2 3 4 |
SELECT column1, column2, column3, COUNT(*) FROM your_table GROUP BY column1, column2, column3 HAVING COUNT(*) > 1; |
1 2 3 4 5 |
DELETE FROM your_table WHERE rowid not in (SELECT MAX(rowid) FROM your_table GROUP BY column1, column2, column3); |
This query deletes all rows except for the one with the highest ROWID for each group of duplicate records. Make sure to replace your_table
, column1
, column2
, and column3
with the actual table name and column names you are working with.
1
|
COMMIT; |
By following these steps, you can efficiently delete duplicate records from a table in Oracle.