To delete the duplicate record from Oracle table.

5 pts.
Tags:
Oracle commands
Oracle Table
How do I delete the duplicate a record from an Oracle table? Please provide the command.


Software/Hardware used:
s/w

Answer Wiki

Thanks. We'll let you know when a new response is added.

You could use something like this:

DELETE
FROM your_table t
WHERE EXISTS
(SELECT 1
FROM your_table
WHERE id = t.id
AND rowid < t.rowid);

In this example ‘id’ would be the field used to identify duplicates.

I used rowid to decide what record to keep in the table, but you could use any other field(s) as needed.

-CarlosDL

———————–

Discuss This Question: 1  Reply

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.
  • Brijesh
    Hi,

    Try using the rowid pseudocolumn.

    DELETE FROM your_table
    WHERE rowid not in
    (SELECT MIN(rowid)
    FROM your_table
    GROUP BY column1, column2, column3);

    Where column1column2, and column3 make up the identifying key for each record. You might list all your columns

    Hope this helps

    14,435 pointsBadges:
    report

Forgot Password

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

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

Thanks! We'll email you when relevant content is added and updated.

Following

Share this item with your network: