Thursday, November 5, 2020

Oracle SQL - How to delete duplicate record in a Oracle table.

 In this example I can explain you how to delete duplicate record in a table using ROWID.

Step 1: Table Script


Step 2: Insert Statement


Step 3: SQL query to find duplicate record count.


 The above query return Count of records stored in the EMP_DTLS table.  All the records have duplicate record except WRK department employee record.

Step 4: How to select and delete duplicate record in a table.

* Query to find which record is going to be delete.


    The Query return duplicate records using Max ROWID.

* Delete statement to delete duplicate record.


 
Final Output

* After delete the duplicate data in the EMP_DTLS table.  There is not duplicate data in the table.  Please check with Step 3.




Thanks & Regards
R. Kalaiyarasan
+91 9944809554

2 comments:

Oracle APEX - How to show Images in Oracle APEX Interactive Report

 In this post, I can explain how to show images in Oracle APEX interactive Report. Table Script CREATE TABLE BLOB_IMAGES (BI_IMG_DESC VA...