Delete full duplicate data from an Oracle table

Source: Internet
Author: User

Today the database except for a problem: a table in the project, the data is from the other system in the same table, but probably because of yesterday's colleague led the data in my table that the data appeared in the exact same situation (all fields), all two, need to delete the same data.

Procedure: 1. Create an intermediate table,

2. Put the non-repeating data in the original table in the intermediate table,

3. Delete the original table data

4. Put the intermediate table data into the original table

5. Delete the intermediate table

--Create an intermediate tableCREATE TABLEAtt_scatter_req_num_temp as(SELECT distinct *  fromatt_scatter_req_num);--Check whether data that contains no duplicate data is inserted into the intermediate tableSelect Count(1) fromatt_scatter_req_num_temp;--Delete all data from the original tableDelete  fromAtt_scatter_req_num;---inserting data from the intermediate table into the original tableInsert  intoAtt_scatter_req_numSelect *  fromatt_scatter_req_num_temp;--data is correctSelect Count(1) fromAtt_scatter_req_num NUM;

Since this is the operation of all the data, be cautious and make sure that there are no problems at every step.

Delete full duplicate data from an Oracle table

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.