RE: Duplicate rows

2002-02-06 Thread Mark Leith

Alex,

Here are a couple of scripts that have come from the list in the past:

===

declare
cursor get_dups is
select pk_col1, pk_col2, pk_col3, count(*)
from table
group by pk_col1, pk_col2, pk_col3
having count(*)  1;
dupRec get_dups%rowtype;
begin
for dupRec in get_dups loop
delete from table
where pk_col1 = dupRec.pk_col1
and pk_col2 = dupRec.pk_col2
and pk_col3 = dupRec.pk_col3
and rownum = 1;
end loop;
end;
/

===

Identify duplicate records:

select COL1,
   COL2,
   COL#,
   COUNT(*)
  from OWNER.TABLE_NAME
 group by COL1, COL2, COL#
having count(*)  1;

Remove duplicate records:

delete from OWNER.TABLE_NAME a
 where rowid  (
select max(rowid)
  from OWNER.TABLE_NAME b
 where b.COL1 = a.COL1
   and b.COL2 = a.COL2
   and b.COL# = a.COL#
 );

===

Just for giggles, if you want to do this on DB2 as well, then check this
out:

http://www.searchDatabase.com/tip/1,289483,sid13_gci784575,00.html

HTH

Mark

-Original Message-
Ordonez
Sent: 06 February 2002 15:33
To: Multiple recipients of list ORACLE-L


Hi gurus,
I need detect and delete duplicate rows in any table, somebody helpme
thanks!!!

@lex

  Lic. Alexander Ordóñez Arroyo
  Caja Costarricense del Seguro Social
  Soporte Técnico - División de Informática
  Telefono: 295-2004, San José, Costa Rica
  [EMAIL PROTECTED]Icq# 30173325


The true is out there in WWW

--
Please see the official ORACLE-L FAQ: http://www.orafaq.com
--
Author: Alexander Ordonez
  INET: [EMAIL PROTECTED]

Fat City Network Services-- (858) 538-5051  FAX: (858) 538-5051
San Diego, California-- Public Internet access / Mailing Lists

To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).

-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Mark Leith
  INET: [EMAIL PROTECTED]

Fat City Network Services-- (858) 538-5051  FAX: (858) 538-5051
San Diego, California-- Public Internet access / Mailing Lists

To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).



Re: Duplicate rows

2002-02-06 Thread Viktor

Here is a query that was posted here a while ago:
delete from pa_answer
where rowid in (select rowid
from p_answer pa
where rowid  (select min(pa2.rowid)
from p_answer pa2
where pa.p_id = pa2.p_id and pa.p_name = pa2.p_name))

This should help.

Viktor


--- Alexander Ordonez [EMAIL PROTECTED] wrote:
 Hi gurus,
 I need detect and delete duplicate rows in any
 table, somebody helpme 
 thanks!!!
 
 @lex


   Lic. Alexander Ordóñez Arroyo 
   Caja Costarricense del Seguro Social  
   
   Soporte Técnico - División de Informática 

   Telefono: 295-2004, San José, Costa Rica  
  
   [EMAIL PROTECTED]Icq# 30173325
 


 The true is out there in WWW
 
 --
 Please see the official ORACLE-L FAQ:
 http://www.orafaq.com
 --
 Author: Alexander Ordonez
   INET: [EMAIL PROTECTED]
 
 Fat City Network Services-- (858) 538-5051  FAX:
 (858) 538-5051
 San Diego, California-- Public Internet
 access / Mailing Lists


 To REMOVE yourself from this mailing list, send an
 E-Mail message
 to: [EMAIL PROTECTED] (note EXACT spelling of
 'ListGuru') and in
 the message BODY, include a line containing: UNSUB
 ORACLE-L
 (or the name of mailing list you want to be removed
 from).  You may
 also send the HELP command for other information
 (like subscribing).


__
Do You Yahoo!?
Send FREE Valentine eCards with Yahoo! Greetings!
http://greetings.yahoo.com
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Viktor
  INET: [EMAIL PROTECTED]

Fat City Network Services-- (858) 538-5051  FAX: (858) 538-5051
San Diego, California-- Public Internet access / Mailing Lists

To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).



RE: Duplicate rows

2002-02-06 Thread Babich , Sergey

Or to just count them:
SELECT col1,col2.coln,count(*) from table 
Group by col1,col2...coln 
Having count(*) 1;


 -Original Message-
Sent:   Wednesday, February 06, 2002 10:33 AM
To: Multiple recipients of list ORACLE-L
Subject:Duplicate rows

Hi gurus,
I need detect and delete duplicate rows in any table, somebody helpme 
thanks!!!

@lex

  Lic. Alexander Ordóñez Arroyo 
  Caja Costarricense del Seguro Social 
  Soporte Técnico - División de Informática 
  Telefono: 295-2004, San José, Costa Rica
  [EMAIL PROTECTED]Icq# 30173325


The true is out there in WWW

-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Alexander Ordonez
  INET: [EMAIL PROTECTED]

Fat City Network Services-- (858) 538-5051  FAX: (858) 538-5051
San Diego, California-- Public Internet access / Mailing Lists

To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).
--
Please see the official ORACLE-L FAQ: http://www.orafaq.com
--
Author: Babich , Sergey
  INET: [EMAIL PROTECTED]

Fat City Network Services-- (858) 538-5051  FAX: (858) 538-5051
San Diego, California-- Public Internet access / Mailing Lists

To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).



Re: Duplicate rows

2002-02-06 Thread Rachel Carmichael

Courtesy of Ari Kaplan of this list:

delete from table_name a where rowid  (select min(rowid)
from table_name b
where a.column_name=b.column_name
)
/


this works if only one column is duplicated but you should be able to
change it (concatenate all the columns together?) if you don't
duplicate on just one column


--- Alexander Ordonez [EMAIL PROTECTED] wrote:
 Hi gurus,
 I need detect and delete duplicate rows in any table, somebody helpme
 
 thanks!!!
 
 @lex
 
   Lic. Alexander Ordóñez Arroyo 
   Caja Costarricense del Seguro Social 
   Soporte Técnico - División de Informática 
   Telefono: 295-2004, San José, Costa Rica
   [EMAIL PROTECTED]Icq# 30173325
 
 
 The true is out there in WWW
 
 --
 Please see the official ORACLE-L FAQ: http://www.orafaq.com
 --
 Author: Alexander Ordonez
   INET: [EMAIL PROTECTED]
 
 Fat City Network Services-- (858) 538-5051  FAX: (858) 538-5051
 San Diego, California-- Public Internet access / Mailing
 Lists
 
 To REMOVE yourself from this mailing list, send an E-Mail message
 to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
 the message BODY, include a line containing: UNSUB ORACLE-L
 (or the name of mailing list you want to be removed from).  You may
 also send the HELP command for other information (like subscribing).


__
Do You Yahoo!?
Send FREE Valentine eCards with Yahoo! Greetings!
http://greetings.yahoo.com
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Rachel Carmichael
  INET: [EMAIL PROTECTED]

Fat City Network Services-- (858) 538-5051  FAX: (858) 538-5051
San Diego, California-- Public Internet access / Mailing Lists

To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).



Re: Duplicate rows

2002-02-06 Thread Stephane Faroult

Alexander Ordonez wrote:
 
 Hi gurus,
 I need detect and delete duplicate rows in any table, somebody helpme
 thanks!!!
 
 @lex
 
   Lic. Alexander Ordóñez Arroyo
   Caja Costarricense del Seguro Social
   Soporte Técnico - División de Informática
   Telefono: 295-2004, San José, Costa Rica
   [EMAIL PROTECTED]Icq# 30173325
 
 

Check the EXCEPTIONS clause of the ALTER TABLE ... ADD CONSTRAINT
command. Create an EXCEPTIONS table, create a unique constraint on the
columns which *should* be unique, then proceed as follows :
create table nodup
as select distinct * from my_table
   where rowid in (select row_id from exceptions
   where table_name = upper('my_table');
(I dislike distinct but sometimes ... :-))
delete my_table
where rowid in (select row_id from exceptions
where table_name = upper('my_table');
insert into my_table
select * from nodup;
drop table nodup;
truncate table exceptions;

and go on with the next table. Write a script which takes a parameter
for all this part, no need to retype it each time.
-- 
Regards,

Stephane Faroult
Oriole Ltd
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Stephane Faroult
  INET: [EMAIL PROTECTED]

Fat City Network Services-- (858) 538-5051  FAX: (858) 538-5051
San Diego, California-- Public Internet access / Mailing Lists

To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).



RE: Duplicate rows

2002-02-06 Thread Alexander Ordonez

thanks for your help!!! 

@lex

  Lic. Alexander Ordóñez Arroyo 
  Caja Costarricense del Seguro Social 
  Soporte Técnico - División de Informática 
  Telefono: 295-2004, San José, Costa Rica
  [EMAIL PROTECTED]Icq# 30173325


The true is out there in WWW

 -Mensaje original-
 De:   Mark Leith [SMTP:[EMAIL PROTECTED]]
 Enviado el:   Miércoles 6 de Febrero de 2002 10:48 AM
 Para: Multiple recipients of list ORACLE-L
 Asunto:   RE: Duplicate rows
 
 Alex,
 
 Here are a couple of scripts that have come from the list in the past:
 
 ===
 
 declare
 cursor get_dups is
 select pk_col1, pk_col2, pk_col3, count(*)
 from table
 group by pk_col1, pk_col2, pk_col3
 having count(*)  1;
 dupRec get_dups%rowtype;
 begin
 for dupRec in get_dups loop
 delete from table
 where pk_col1 = dupRec.pk_col1
 and pk_col2 = dupRec.pk_col2
 and pk_col3 = dupRec.pk_col3
 and rownum = 1;
 end loop;
 end;
 /
 
 ===
 
 Identify duplicate records:
 
 select COL1,
COL2,
COL#,
COUNT(*)
   from OWNER.TABLE_NAME
  group by COL1, COL2, COL#
 having count(*)  1;
 
 Remove duplicate records:
 
 delete from OWNER.TABLE_NAME a
  where rowid  (
 select max(rowid)
   from OWNER.TABLE_NAME b
  where b.COL1 = a.COL1
and b.COL2 = a.COL2
and b.COL# = a.COL#
  );
 
 ===
 
 Just for giggles, if you want to do this on DB2 as well, then check this
 out:
 
 http://www.searchDatabase.com/tip/1,289483,sid13_gci784575,00.html
 
 HTH
 
 Mark
 
 -Original Message-
 Ordonez
 Sent: 06 February 2002 15:33
 To: Multiple recipients of list ORACLE-L
 
 
 Hi gurus,
 I need detect and delete duplicate rows in any table, somebody helpme
 thanks!!!
 
 @lex
 
   Lic. Alexander Ordóñez Arroyo
   Caja Costarricense del Seguro Social
   Soporte Técnico - División de Informática
   Telefono: 295-2004, San José, Costa Rica
   [EMAIL PROTECTED]Icq# 30173325
 
 
 The true is out there in WWW
 
 --
 Please see the official ORACLE-L FAQ: http://www.orafaq.com
 --
 Author: Alexander Ordonez
   INET: [EMAIL PROTECTED]
 
 Fat City Network Services-- (858) 538-5051  FAX: (858) 538-5051
 San Diego, California-- Public Internet access / Mailing Lists
 
 To REMOVE yourself from this mailing list, send an E-Mail message
 to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
 the message BODY, include a line containing: UNSUB ORACLE-L
 (or the name of mailing list you want to be removed from).  You may
 also send the HELP command for other information (like subscribing).
 
 -- 
 Please see the official ORACLE-L FAQ: http://www.orafaq.com
 -- 
 Author: Mark Leith
   INET: [EMAIL PROTECTED]
 
 Fat City Network Services-- (858) 538-5051  FAX: (858) 538-5051
 San Diego, California-- Public Internet access / Mailing Lists
 
 To REMOVE yourself from this mailing list, send an E-Mail message
 to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
 the message BODY, include a line containing: UNSUB ORACLE-L
 (or the name of mailing list you want to be removed from).  You may
 also send the HELP command for other information (like subscribing).
--
Please see the official ORACLE-L FAQ: http://www.orafaq.com
--
Author: Alexander Ordonez
  INET: [EMAIL PROTECTED]

Fat City Network Services-- (858) 538-5051  FAX: (858) 538-5051
San Diego, California-- Public Internet access / Mailing Lists

To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).



Re: Duplicate rows

2002-02-06 Thread Rick_Cale


DELETE FROM table a
WHERE a.rowid  (SELECT MIN(b.rowid)
  FROM table b
  WHERE b.key_field1 = a.keyfield1
  AND b.key_field2 = a.keyfield2
  AND b.key_fieldN = a.keyfieldN);

Be certain to include all fields in WHERE clause that make up a unique
record.

Rick



   

Alexander  

Ordonez  To: Multiple recipients of list ORACLE-L 
[EMAIL PROTECTED]   
aordonez@ccscc:   

s.sa.cr Subject: Duplicate rows   

Sent by:   

root@fatcity.  

com

   

   

02/06/2002 

10:33 AM   

Please 

respond to 

ORACLE-L   

   

   





Hi gurus,
I need detect and delete duplicate rows in any table, somebody helpme
thanks!!!

@lex

  Lic. Alexander Ordóñez Arroyo
  Caja Costarricense del Seguro Social
  Soporte Técnico - División de Informática
  Telefono: 295-2004, San José, Costa Rica
  [EMAIL PROTECTED]Icq# 30173325


The true is out there in WWW

--
Please see the official ORACLE-L FAQ: http://www.orafaq.com
--
Author: Alexander Ordonez
  INET: [EMAIL PROTECTED]

Fat City Network Services-- (858) 538-5051  FAX: (858) 538-5051
San Diego, California-- Public Internet access / Mailing Lists

To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).




--
Please see the official ORACLE-L FAQ: http://www.orafaq.com
--
Author:
  INET: [EMAIL PROTECTED]

Fat City Network Services-- (858) 538-5051  FAX: (858) 538-5051
San Diego, California-- Public Internet access / Mailing Lists

To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).



RE: Duplicate rows

2002-02-06 Thread Alexander Ordonez

thanks!!!

@lex

  Lic. Alexander Ordóñez Arroyo 
  Caja Costarricense del Seguro Social 
  Soporte Técnico - División de Informática 
  Telefono: 295-2004, San José, Costa Rica
  [EMAIL PROTECTED]Icq# 30173325


The true is out there in WWW

 -Mensaje original-
 De:   [EMAIL PROTECTED] [SMTP:[EMAIL PROTECTED]]
 Enviado el:   Miércoles 6 de Febrero de 2002 10:26 AM
 Para: [EMAIL PROTECTED]; [EMAIL PROTECTED]
 Asunto:   Re: Duplicate rows
 
 
 DELETE FROM table a
 WHERE a.rowid  (SELECT MIN(b.rowid)
   FROM table b
   WHERE b.key_field1 = a.keyfield1
   AND b.key_field2 = a.keyfield2
   AND b.key_fieldN = a.keyfieldN);
 
 Be certain to include all fields in WHERE clause that make up a unique
 record.
 
 Rick
 
 
 
  
 
 Alexander
 
 Ordonez  To: Multiple recipients of
 list ORACLE-L [EMAIL PROTECTED]   
 aordonez@ccscc:
 
 s.sa.cr Subject: Duplicate rows
 
 Sent by:
 
 root@fatcity.
 
 com
 
  
 
  
 
 02/06/2002
 
 10:33 AM
 
 Please
 
 respond to
 
 ORACLE-L
 
  
 
  
 
 
 
 
 
 Hi gurus,
 I need detect and delete duplicate rows in any table, somebody helpme
 thanks!!!
 
 @lex
 
   Lic. Alexander Ordóñez Arroyo
   Caja Costarricense del Seguro Social
   Soporte Técnico - División de Informática
   Telefono: 295-2004, San José, Costa Rica
   [EMAIL PROTECTED]Icq# 30173325
 
 
 The true is out there in WWW
 
 --
 Please see the official ORACLE-L FAQ: http://www.orafaq.com
 --
 Author: Alexander Ordonez
   INET: [EMAIL PROTECTED]
 
 Fat City Network Services-- (858) 538-5051  FAX: (858) 538-5051
 San Diego, California-- Public Internet access / Mailing Lists
 
 To REMOVE yourself from this mailing list, send an E-Mail message
 to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
 the message BODY, include a line containing: UNSUB ORACLE-L
 (or the name of mailing list you want to be removed from).  You may
 also send the HELP command for other information (like subscribing).
 
 
 
--
Please see the official ORACLE-L FAQ: http://www.orafaq.com
--
Author: Alexander Ordonez
  INET: [EMAIL PROTECTED]

Fat City Network Services-- (858) 538-5051  FAX: (858) 538-5051
San Diego, California-- Public Internet access / Mailing Lists

To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).



Re: Duplicate rows

2002-02-06 Thread Joan Hsieh

delete from z where rowid in (select rowid from z a where a.rowid 
(select
min(rowid) from z b where a.x = b.x));

Alexander Ordonez wrote:
 
 Hi gurus,
 I need detect and delete duplicate rows in any table, somebody helpme
 thanks!!!
 
 @lex
 
   Lic. Alexander Ordóñez Arroyo
   Caja Costarricense del Seguro Social
   Soporte Técnico - División de Informática
   Telefono: 295-2004, San José, Costa Rica
   [EMAIL PROTECTED]Icq# 30173325
 
 
 The true is out there in WWW
 
 --
 Please see the official ORACLE-L FAQ: http://www.orafaq.com
 --
 Author: Alexander Ordonez
   INET: [EMAIL PROTECTED]
 
 Fat City Network Services-- (858) 538-5051  FAX: (858) 538-5051
 San Diego, California-- Public Internet access / Mailing Lists
 
 To REMOVE yourself from this mailing list, send an E-Mail message
 to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
 the message BODY, include a line containing: UNSUB ORACLE-L
 (or the name of mailing list you want to be removed from).  You may
 also send the HELP command for other information (like subscribing).
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Joan Hsieh
  INET: [EMAIL PROTECTED]

Fat City Network Services-- (858) 538-5051  FAX: (858) 538-5051
San Diego, California-- Public Internet access / Mailing Lists

To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).



RE: Duplicate rows

2002-02-06 Thread Babich , Sergey

Delete from table_name where rowid not in(select min(rowid) from table_name
group by col1,col2,...coln);
Best,
Sergey

 -Original Message-
Sent:   Wednesday, February 06, 2002 10:33 AM
To: Multiple recipients of list ORACLE-L
Subject:Duplicate rows

Hi gurus,
I need detect and delete duplicate rows in any table, somebody helpme 
thanks!!!

@lex

  Lic. Alexander Ordóñez Arroyo 
  Caja Costarricense del Seguro Social 
  Soporte Técnico - División de Informática 
  Telefono: 295-2004, San José, Costa Rica
  [EMAIL PROTECTED]Icq# 30173325


The true is out there in WWW

-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Alexander Ordonez
  INET: [EMAIL PROTECTED]

Fat City Network Services-- (858) 538-5051  FAX: (858) 538-5051
San Diego, California-- Public Internet access / Mailing Lists

To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).
--
Please see the official ORACLE-L FAQ: http://www.orafaq.com
--
Author: Babich , Sergey
  INET: [EMAIL PROTECTED]

Fat City Network Services-- (858) 538-5051  FAX: (858) 538-5051
San Diego, California-- Public Internet access / Mailing Lists

To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).



RE: Duplicate rows

2002-02-06 Thread Van M. Etheridge
Title: RE: Duplicate rows





Delete duplicate records


Sanjay Raj 
06 Dec 2001, Rating 4.42 (out of 5)
Here is a short Oracle script that deletes duplicate records from a table based on the unique columns selected:
Rem del_dup.sql 
Rem 
Rem Script to delete duplicate rows from a table 
Rem 
Rem Enter Table_Name as MY_TABLE 
Rem And Column_List as COLUMN_1,COLUMN_2,COLUMN_3 ... Column_N 
Rem (i.e. no spaces) 
Rem 
Rem 
Accept table_name Prompt 'Enter Table Name: ' 
Accept column_list Prompt 'Enter Column List (no spaces): ' 
BEGIN 
 LOOP 
 DELETE FROM table_name 
 WHERE ROWID IN (SELECT MIN (ROWID) 
 FROM table_name 
 GROUP BY column_list 
 HAVING COUNT (*)  1); 
 EXIT WHEN SQL%NOTFOUND; 
 END LOOP; 
 COMMIT; 
END; 
/ 



-Original Message-
From: Alexander Ordonez [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, February 06, 2002 10:33 AM
To: Multiple recipients of list ORACLE-L
Subject: Duplicate rows



Hi gurus,
I need detect and delete duplicate rows in any table, somebody helpme 
thanks!!!


@lex

 Lic. Alexander Ordóñez Arroyo 
 Caja Costarricense del Seguro Social 
 Soporte Técnico - División de Informática 
 Telefono: 295-2004, San José, Costa Rica 
 [EMAIL PROTECTED] Icq# 30173325



The true is out there in WWW


-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Alexander Ordonez
 INET: [EMAIL PROTECTED]


Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051
San Diego, California -- Public Internet access / Mailing Lists

To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from). You may
also send the HELP command for other information (like subscribing).





Re: Duplicate rows

2002-02-06 Thread orantdba

Hi,

Probably the best way is to attempt to enable a unique constraint and 
use the exceptions table to find the rowid's all rows that violate the 
constraint.

John

[EMAIL PROTECTED] wrote:

Hi gurus,
I need detect and delete duplicate rows in any table, somebody helpme 
thanks!!!

@lex

  Lic. Alexander Ordóñez Arroyo 
  Caja Costarricense del Seguro Social 
  Soporte Técnico - División de Informática 
  Telefono: 295-2004, San José, Costa Rica
  [EMAIL PROTECTED]Icq# 30173325


The true is out there in WWW



-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: orantdba
  INET: [EMAIL PROTECTED]

Fat City Network Services-- (858) 538-5051  FAX: (858) 538-5051
San Diego, California-- Public Internet access / Mailing Lists

To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).



Re: Duplicate rows

2002-02-06 Thread Rachel Carmichael

um yeah, that works too :)


--- orantdba [EMAIL PROTECTED] wrote:
 Hi,
 
 Probably the best way is to attempt to enable a unique constraint and
 
 use the exceptions table to find the rowid's all rows that violate
 the 
 constraint.
 
 John
 
 [EMAIL PROTECTED] wrote:
 
 Hi gurus,
 I need detect and delete duplicate rows in any table, somebody
 helpme 
 thanks!!!
 
 @lex
 
   Lic. Alexander Ordóñez Arroyo 
   Caja Costarricense del Seguro Social 
   Soporte Técnico - División de Informática 
   Telefono: 295-2004, San José, Costa Rica
   [EMAIL PROTECTED]Icq# 30173325
 
 
 The true is out there in WWW
 
 
 
 -- 
 Please see the official ORACLE-L FAQ: http://www.orafaq.com
 -- 
 Author: orantdba
   INET: [EMAIL PROTECTED]
 
 Fat City Network Services-- (858) 538-5051  FAX: (858) 538-5051
 San Diego, California-- Public Internet access / Mailing
 Lists
 
 To REMOVE yourself from this mailing list, send an E-Mail message
 to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
 the message BODY, include a line containing: UNSUB ORACLE-L
 (or the name of mailing list you want to be removed from).  You may
 also send the HELP command for other information (like subscribing).


__
Do You Yahoo!?
Send FREE Valentine eCards with Yahoo! Greetings!
http://greetings.yahoo.com
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Rachel Carmichael
  INET: [EMAIL PROTECTED]

Fat City Network Services-- (858) 538-5051  FAX: (858) 538-5051
San Diego, California-- Public Internet access / Mailing Lists

To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).



Re: Duplicate rows.

2001-08-23 Thread Rukmini Devi

Hi ,
try this query

delete from z where rowid in (select rowid from z a where a.rowid  (select
min(rowid) from z b where a.x = b.x));

rukmini
- Original Message -
To: Multiple recipients of list ORACLE-L [EMAIL PROTECTED]
Sent: Friday, August 24, 2001 9:55 AM


 hi lists

 can anybody tell me how to delete duplicate rows in the table.

 my table has 10 rows (5 sets of each 2 records) all are identical.

 how to delete 1 full set. I need the rows value should be distinct.

 I tried

 create table xyz as select distinct and finished the task.

 but this is a lengthy process.

 any short way?

 srinivas
 --
 Please see the official ORACLE-L FAQ: http://www.orafaq.com
 --
 Author: Tatireddy, Shrinivas (MED, Keane)
   INET: [EMAIL PROTECTED]

 Fat City Network Services-- (858) 538-5051  FAX: (858) 538-5051
 San Diego, California-- Public Internet access / Mailing Lists
 
 To REMOVE yourself from this mailing list, send an E-Mail message
 to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
 the message BODY, include a line containing: UNSUB ORACLE-L
 (or the name of mailing list you want to be removed from).  You may
 also send the HELP command for other information (like subscribing).

-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Rukmini Devi
  INET: [EMAIL PROTECTED]

Fat City Network Services-- (858) 538-5051  FAX: (858) 538-5051
San Diego, California-- Public Internet access / Mailing Lists

To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).