How to remove the duplicate value row using self join in Oracle !! please assist

Questions by jambesh

Showing Answers 1 - 18 of 18 Answers

kasi

  • Feb 17th, 2007
 

suppose a table test contains
--------------------------------------
ename                         eno
-------------------------------------
kasi                                   1

kasi                                   1

This duplicate can be removed using rowid with self join

delete * from test where rowid>(select Min(rowid) from test t where t.ename=test.ename);


  Was this answer useful?  Yes

anonymous

  • Sep 8th, 2007
 


Here in this query, the rowid (which is assigned to every row for every row of table ion oracle is used to identify and delete the duplicate rows in the table)as there is no other way of doing the same.

The smallest row id of the row is taken for comparing the other rowids and delete the one greater than the comparision value.

  Was this answer useful?  Yes

Mital Mehta

  • Oct 12th, 2007
 


Kasi , you are right but the syntax is Wrong .
if u write delete *  it will not work .

u have to write like this way

delete from test where rowid>(select Min(rowid) from test t where t.ename=test.ename)

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions