How to delete duplicates in oracle 10g ( strange behaviour)

Recently we migrated from oracel 8i to oralce 10g and we face this problem.
When we try to delete duplicates using rowid ( analytical functions row_number()/
or normal delete ) and commit the same , still we find some duplicates to be existing because of which we are not able to enable costriants and resulting in process failure.
When we run the same delete statement next time it removes more duplicates than the required or sometimes required duplicates resulting in abnormal behaviour.
I don not understand this strange behaviour after upgrading to oracle 10g.
It'd be great if some one who has idea on this can throw light on the same.
thanks

Gasparotto,
Thanks a lot for letting me know a new procedure to delete duplicates sing lead function.
I've tried this code on a temp table and it worked, let me use the same query on the prodn side and test the same.
Procedure for deletion of duplicates using lead analytical function.
create table temp ( col1 number(2) , col2 number(2) , col3 number(2));
insert into temp values ( 1,2,10);
insert into temp values ( 1,2,20);
insert into temp values ( 1,2,30);
insert into temp values ( 3,2,10);
insert into temp values ( 3,4,12);
insert into temp values ( 3,4,45);
commit;
COL1 COL2 COL3
1 2 10
1 2 20
1 2 30
3 2 10
3 4 12
3 4 45
select col1,col2 , col3, LEAD(rowid) OVER (PARTITION BY col1,col2 order by null) from temp;
COL1 COL2 COL3 LEAD(ROWID)OVER(PA
1 2 10 AAAVBjAApAAAFyGAAB
1 2 20 AAAVBjAApAAAFyGAAC
1 2 30
3 2 10
3 4 12 AAAVBjAApAAAFyGAAF
3 4 45
6 rows selected.
select rowid , temp.* from temp ;
ROWID COL1 COL2 COL3
AAAVBjAApAAAFyGAAA 1 2 10
AAAVBjAApAAAFyGAAB 1 2 20
AAAVBjAApAAAFyGAAC 1 2 30
AAAVBjAApAAAFyGAAD 3 2 10
AAAVBjAApAAAFyGAAE 3 4 12
AAAVBjAApAAAFyGAAF 3 4 45
SQL> DELETE temp
WHERE rowid IN
( SELECT LEAD(rowid) OVER (PARTITION BY col1, col2 ORDER BY null)
FROM temp ); 2 3 4
3 rows deleted.
SQL> select rowid , temp.* from temp ;
ROWID COL1 COL2 COL3
AAAVBjAApAAAFyGAAA 1 2 10
AAAVBjAApAAAFyGAAD 3 2 10
AAAVBjAApAAAFyGAAE 3 4 12
Thanks for the reply

Similar Messages

  • How to delete client from oracle 10g ASM

    Hi,
    I would like to know how to delete client from oracle 10g ASM, while configuring Dataguard in same windows os i have by mistake created the standby in ASM.
    However later i have corrected the datafile destination. My Primary database is in ASM and the standby in disk.
    Could anyone please tell me how do i delete the client from ASM. On view from asmcmd it shows db_unknown and from v$asm_client
    GROUP_NUMBER INSTANCE_NAME
    DB_NAME STATUS
    SOFTWARE_VERSION
    COMPATIBLE_VERSION
    1 stby
    stby CONNECTED
    10.2.0.1.0
    10.2.0.1.0
    Thanks and regards,
    shaan

    Hi Deepak,
    Pls see the result from the view, i wanted to delete stby
    SQL> select * from v$asm_client;
    GROUP_NUMBER INSTANCE_NAME
    DB_NAME STATUS
    SOFTWARE_VERSION
    COMPATIBLE_VERSION
    1 prim
    prim CONNECTED
    10.2.0.1.0
    10.2.0.1.0
    2 prim
    prim CONNECTED
    10.2.0.1.0
    10.2.0.1.0
    1 stby
    stby CONNECTED
    10.2.0.1.0
    10.2.0.1.0
    regards,
    shaan

  • How to recreate datafile in oracle 10g.

    pls tell me how to recreate datafile in oracle 10g...
    what are situation to recreate datafile
    Edited by: 898085 on Nov 18, 2011 9:16 PM

    898085 wrote:
    pls tell me how to recreate datafile in oracle 10g...
    what are situation to recreate datafile
    Edited by: 898085 on Nov 18, 2011 9:16 PMDid u mean create or recreate?
    if datafie is deleted then you may add it into existing tablespace.
    Try this : -
    1.)sqlplus sys/xx as sysdba
    2.)alter tablespace <tablespace_name> add datafile <datafile_name> size <give size>;
    HTH:-)

  • How to delete duplicate value in movement type 541 & 542(alv report)

    hi experts,
    i have some problem in alv report,
    input we can give some movement type for ex(101,102,541,542, etc)
    how to delete duplicate value in 541 and 542.
    regards
    gunasekaran.

    Try:
    Delete adjacent duplicates from ITAB comparing FIELD1, FIELD2.
    to do this the ITAB must be Sorted first.!

  • How to delete duplicate records in 10 G.

    how to delete duplicate records in 10 G.

    --Here is one way to do it using a second table 
    create table temp1
    (col1 char(1));
    --Table created.
    insert into temp1 (col1) values('A');
    insert into temp1 (col1) values('B');
    insert into temp1 (col1) values('B');
    --1 row created.
    --1 row created.
    --1 row created.
    create table temp2 as select distinct * from temp1;
    --Table created.
    --now you have a second table with no duplicates
    --truncate your old table
    truncate table temp1;
    --Table truncated.
    --and reload it with data from the new table
    insert into temp1 select * from temp2;
    --2 rows created.
    --then drop the temp2 table
    drop table temp2

  • HT204406 How to delete duplicate songs from Libary without deleting them from play list or other devices

    How to delete duplicate songs from libary without deleting them from playlist or other devices

    I'm with you verm71; it's not entirely clear how Apple is expecting you to manage this.  I'm going on vacation soon and want to clean up my phone so that it's nice and empty for the new pictures.  There doesn't seem to be a way to do this without losing your pictures in the new Photos as well.  If imported, it's impossible to see which is the Cloud version and which is the Local version.  It's very annoying.
    I've also noticed in iPhoto you used to have the ability to locate the original of the picture inside the photo database.  That option is not provided in Photos, making finding the original extremely difficult.
    It seems to be a great, well-oiled system.  But I would love to know how Apple envisions the typical workflow for archiving...

  • How to delete duplicate pictures from Photo Library

    How to delete duplicate pictures from Photo Library in iPhone 3G 16 giga?

    The only way to delete photos from the photo library is by the same way the photos were transferred to your iPhone - via the iTunes sync process.
    Are you saying a photo or all photos transferred to your iPhone via the iTunes sync process are duplicated in your iPhone's Photo Library without being duplicated in the folder on your computer where these photos are stored?

  • How to delete duplicate photos on ipod touch, NOT in camera roll

    how to delete duplicate photos on ipod touch, NOT on camera roll

    What do you mean?
    Do you have duplicates in one album? If so how did that album get on the iPod?
    If yo mean yo have them in different albums then what specific albums and how did those albums get on the iPod?

  • How to export AWM in Oracle 10g

    Hi All,
    Im doing export of my Analytical Workspace with option tables=AW$TEST, this command failed and thrown EXP-00055: CALLDETAIL_TEST.AW$TEST is marked not exportable, i checked NOEXP$ table and i can find my AW name in it, according to table definition i cann't perform export of those objects listed in NOEXP$ table right, I want to know from you pals how can i export AW and then import it ?
    Need your feedback asap.
    Thanking you pals in advance
    Hassan khan

    Abhii wrote:
    How to store image in Oracle 10g?
    any example ?http://www.google.co.in/search?rlz=1C1GGLS_enIN321IN321&sourceid=chrome&ie=UTF-8&q=How+to+store+image+in+Oracle
    HTH
    Aman....

  • How to use iframes in oracle 10g

    I have to load two jsp pages in a single html . I have done that thru iframes. But i have to dynamically load the second jsp page in the frame 2 , when the user clicks upon certain details in the frame 1 jsp page. I have wriiten the code of document.iframe in format trigger attribute. It doesn't work. Is there any other way to achieve this. I want to load the frame 2 jsp page dynamically , according to the input i get from frame 1 jsp page.

    Hi,
    >>Anybody know how to use profiler in oracle 10g
    What do you mean "profiler". About Resource Limits/Create Profiles ?
    >>i couldn't able to install the enterprise manager console.
    What OS ?
    >>because i need to trace the execution of a stored procedure.waiting the reply.
    Debug ? You can use SQL Developer, TOAD, PLSQL Developer for this purpose.
    Cheers

  • How to Send mail in oracle 10g

    I am new in oracle developer.....we are using oracle 10g developer...how to send mail through oracle 10g on a button click.pease help me.
    Thanks in advance

    This question have been asked many times on this forum, see if you get help from following:
    https://forums.oracle.com/message/5395438#5395438
    Search results: https://forums.oracle.com/thread/search.jspa?peopleEnabled=true&userID=&containerType=&container=&q=form+email
    Check this out as well:
    http://nzchaudhry.wordpress.com/2013/05/31/send-report-via-email-attachment-in-oracle-forms-10g/
    You can find init.ora or initSID.ora file under $ORACLE_HOME/dbs on linux and on Windows under $ORACLE_HOME/database. Otherwise you can create it using "create pfile from spfile" command
    Aneel

  • How to Use Profiler in ORACLE 10g

    Hi all,
    Anybody know how to use profiler in oracle 10g and also i couldn't able to install the enterprise manager console.is there any tools available for that.because i need to trace the execution of a stored procedure.waiting the reply.
    Sathish

    Hi,
    >>Anybody know how to use profiler in oracle 10g
    What do you mean "profiler". About Resource Limits/Create Profiles ?
    >>i couldn't able to install the enterprise manager console.
    What OS ?
    >>because i need to trace the execution of a stored procedure.waiting the reply.
    Debug ? You can use SQL Developer, TOAD, PLSQL Developer for this purpose.
    Cheers

  • How to Configure Webutil in Oracle 10g Developer Suit

    Dear All,
    How to Configure Webutil in Oracle 10g Developer Suit.
    Please give me the step by step solution.
    Thanks and Regards,
    Fazil

    This is a very frequently asked question. Searching the Forum or the Forms Help system would have given you your answer! Search Forms Help on "Configure WebUtil" and read the configuration guide and checklist articles.
    Craig...

  • How to Delete duplicates rows without using rowid/distinct.

    How to delete duplicates rows present in a table without using rowid or even distinct.

    How about:
    SQL> SELECT * FROM t1;
             A          B
             1          2
             2          3
             1          2
             4          4
             4          4
             4          4
    SQL> DELETE FROM t1
      2  WHERE (a, b) IN (SELECT a, b FROM t1
      3                   GROUP BY a, b
      4                   HAVING COUNT(*) > 1) and
      5        rownum = 1;
    1 row deleted.
    SQL> /
    1 row deleted.
    SQL> /
    1 row deleted.
    SQL> /
    0 rows deleted.
    SQL> SELECT * FROM t1;
             A          B
             2          3
             1          2
             4          4Although, if I was asked a similar question with all those restrictions, my first response would be along the lines of: Is this question indicative of the way I will have to work if I join this company? If so, there is no point answering because I wouldn't touch this job with a ten foot pole.

  • HT5043 How to delete duplicate photos

    how to delete duplicate photos in iphoto

    iPhoto has no built-in duplicate detector. You can spot duplicates by sorting your photos by title or date, or use third-party applications like iPhoto Library Manager, Duplicate Annihilator, Photo Sweeper.
    Old Toad has published a great list of apps that can screen your iPhoto Library for duplicates, see this link:
    Re: How can I search for duplicate photos in iPhoto libraries?
    My favourite is Photo Sweeper, because it lets me stay in control of what will be deleted, shows all metadata, lets me define the criteria for marking duplicates, and can recognise duplicates of different sizes, based on histograms or pixel maps.  PhotoSweeper

Maybe you are looking for

  • Problem with GET table

    Dear Friends, I have upload one program for customer ageing report. In that there is statements like GET LFA1, GET BSIK etc. when i save and check it throughs an error that "lfa1 is not defined for the current logical database'. but these statements

  • Connecting Iphone to my Laptop

    I cannot connect my iphone 4 to my laptop because the pairing records are missing. I was just wondering how to fix this problem. Thanks

  • Insufficient privileges, permissions error, cannot authorise computer for Itunes

    I am trying to authorise my computer to itunes and get this error message: "The required file was not found or has a permissions error. Correct this permissions problem and try again, or deauthorize this computer if the permissions cannot be changed.

  • I want to get Both

    Hi, As per my knowledge(which is very little). A call RecordEnumeration.nextRecordId will consume one record so my next call to nextRecord will have a different Id then the nextRecordId returned and vice versa a call to nextRecord, and followed by ne

  • Delivery notes against STO

    Hi all, Is there any standard report to see the list of delivery notes created against Stock transport orders. Regards sappy