How to delete duplicate rows in oracle and retaining last duplicate rows

Hi,
I'm having millions of records in the table .Some duplicate values/rows are inserted in it.
I just want to delete duplicate rows but also want to retain the last duplicate row.
For eg if one record is found three times ,i want to delete first and second record and retain
the third one i.e the last inserted one.
Regards
Paramdeep Singh

user13310594 wrote:
Hi,
I'm having millions of records in the table .Some duplicate values/rows are inserted in it.
I just want to delete duplicate rows but also want to retain the last duplicate row.
For eg if one record is found three times ,i want to delete first and second record and retain
the third one i.e the last inserted one.Hi Paramdeep,
To start with, since you do not wish to keep multiple rows with same values, why allow them to get inserted in the first place?
Wouldn't it be easier to block duplicate rows from inserting by creating a Unique constraint on Column(s) that define a row as duplicate, then rather deleting duplicate rows periodically?
For deleting duplicate rows, there are N number of techniques available. Always remember, you need to have a rigid criteria that marks row as duplicate.
[url http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:15258974323143]this is one recomended by tom for large tables.
Vivek L

Similar Messages

  • How to find out when data was deleted from table in oracle and Who deleted that

    HI Experts,
    Help me for below query:
    how to find out when data was deleted from table in oracle and Who deleted that ?
    I did that to fidn out some data from dba_tab_modifications, but I m not sure that what timestamp shows, wether it shows for update,insert or delete time ?
    SQL> select TABLE_OWNER,TABLE_NAME,INSERTS,UPDATES,DELETES,TIMESTAMP,DROP_SEGMENTS,TRUNCATED from dba_tab_modifications where TABLE_NAME='F9001';
    TABLE_OWNER                    TABLE_NAME                        INSERTS    UPDATES    DELETES     TIMESTAMP         DROP_SEGMENTS TRU
    PRODCTL                        F9001                                                     1683         46       2171            11-12-13 18:23:39             0                   NO
    Audit is enable in my enviroment?
    customer is facing the issue and data missing in the table and I told him that yes there is a delete at 11-12-13 18:23:39 in table after seeing the DELETS column and timestamp in dba_tab_modifications, but not sure I am right or not
    SQL> show parameter audit
    NAME                                 TYPE        VALUE
    audit_file_dest                      string      /oracle/admin/pbowe/adump
    audit_sys_operations                 boolean     TRUE
    audit_syslog_level                   string
    audit_trail                          string      DB, EXTENDED
    please help
    Thanks
    Sam

    LOGMiner --> Using LogMiner to Analyze Redo Log Files
    AUDIT --> Configuring and Administering Auditing

  • How do I delete photo ALBUMS from my iPHONE 4? I sync via icloud and I can not see any folders selected in itunes. I searched the internet and basically there is no one who has the answer to how you delete the iphone photo library and misc albums

    how do I delete photo ALBUMS from my iPHONE 4?
    I sync via icloud and I can not see any folders selected in itunes.
    I searched the internet and basically there is no one who has the answer (so far)
    to how you delete the iphone photo library and misc albums
    I have also had every iphone and I am not stupid.
    charles altman

    Replying to my own post - heh. I downloaded iExplorer (http://www.macroplant.com/iexplorer/) which allowed me access to the files on the phone and there was the phantom movie in the DCIM folder. Deleted it, and all is well - although I still have 0.65gb of Other in iTunes.....

  • I recently downloaded Ios 7 and all the songs that i have purchased before but deleted off my itunes because i didn't want them showed up. I don't know how to delete them off my ipod and i really don't want them there

    I recently downloaded Ios 7 and all the songs that i have purchased before, but deleted off my itunes because i didn't want them, showed up. I don't know how to delete them off my ipod and i really don't want them there. Is there a way to get them off? The songs dont show up in my itunes on my computer, just on my ipod with a download button next to them. I don't want them there anymore because i don't like that kind of music anymore and i don't know how to get them to go away.

    There is a similar setting for Videos on that Settings screen, so if you leave that 'on' you may have similar happening in the Videos app

  • How to delete old version of itunes and install the latest? When I update an error message pop-up.  "the feature you are trying to use is on a network resource that is unavailable".  Plese help!

    How to delete older version of itunes and installed the new version? When I try to install the new version (update) a message popup.  " The feature you are trying to use is on a network resourse that is unavailable".  Please can someone help? Thanks!

    Which particular .msi file is the message going on to say can't be found? (Several different msi files can be mentioned in this context: itunes.msi, bonjour.msi, AppleSoftwareUpdate.msi, etc.)

  • How to create xml file from Oracle and sending the same xml file to an url

    How to create xml file from Oracle and sending the same xml file to an url

    SQL/XML (XMLElement, XMLForest, XMLAgg, etc) and UTL_HTTP.
    Whether that works for you with the version of Oracle you have, your requirements, and needs is another story. A little detail goes a long way.

  • How to delete developer's SAP UserID and his SSCR key on SMP?

    How to delete developer's SAP UserID and his SSCR key on SMP?
    Dear Experts,
    Background:
    I want to delete developer's SAP UserID and SSCR key in QAS and SMP.
    Because as I known, developer's SAP UserID(registered SSCR key) is belonging to the SAP License measurement.
    I want to rid of the useless developer's SAP userID and the SSCR key registered on SMP.
    ====================Here below is the message I created===================
    Dear Expert,
    One of our developers whom registered SSCR key left, I want to delete
    his SAP UserID and his SSCR key.Can you pls tell me how to implement?
    What might have happened(expecially the downside) in the corresponding
    SAP Client if I delete the developer's SAP UserID and SSCR key? Will
    it cause our system screw up?
    I've searched the answer on SDN. Someone told me I should carry out the
    follow steps below:
    (1)Delete the Developer's SSCR key on Service Market Place(SMP).
    (2)Cancel all the Jobs defined by the Developer in DEV.
    (3)SU01, Replace the value 'Developer' with Blank at the 'LicenceData'
    lable.
    (4)Delte corresponding item of the Developer in 'DEVACCESS' table.
    (5)Lock/Delete the Developer.
    Is that right?
    Thanks!
    Jason   
    ====================Here below is the reply from SAP===================
    Dear Customer,
    When the SSCR Developer/Object keys are transfered to the system, the
    keys are stored in the following tables:
    o DEVACCESS : Developer keys
    o ADIRACCESS: Object keys
    But we do not have any report programs to delete the entries from these
    tables. If the customer wants to delete the entries, he has to write a
    local program to delete the table entries.
    SAP does not recommend ever cleaning out these developer keys, as long
    as the user ID is Locked / Deleted, that is the main thing.
    please Cancel all the Jobs defined by the Developer in DEV.
    So my recommendation to you is to first lock the user id of the user.
    Then Assign him a new userid which is not identical to the first one andthen subsequently delete the old userid.
    If you have an absolute need to delete a developer key without deleting
    a user then the easiest way to do this is probably to
    write a report with the instruction :
    delete from DEVACCESS where UNAME = ....
    Please note :
    There is no recording, who did what in the table, that is why SAP strong-ly does not recommend this, and customers will have to take responsibil-ity for this action.
    Thanks
    ====================My question is:===================
    Do you have any better suggestions?

    Hi,Rahul,Raghunandan
    Thank you very much!
    Her below were the SAP Support's main suggestions:
    1. Lock the user id of the user, then Assign him a new userid which is not identical to the first one and then subsequently delete the old userid.
    2. If you have an absolute need to delete a developer key without deleting a user then the easiest way to do this is probably to write a report.
    I want to know if I can delete the SSCR key directly via a particular TX? If I can, what is it? (I just want to know. For safety, I think I won't delete the SSCR key directly remained in 'DEVACCESS'.)
    Thanks!
    Jason

  • How to delete data off time capsule and restart

    how to delete data off time capsule and restart

    Open Finder > Applications > Utilities > AirPort Utility
    Click on the Time Capsule, then click Edit in the smaller window that appears
    Click the Disks tab at the top of the screen
    Click Erase Disk
    Choose the Quick Erase option
    Click Erase
    The procedure will take a minute or two.  The Time Capsule is now ready for a new backup

  • How do I restore to factory setting AND retain the tunes and apps on the phone or get them synched?

    I'm getting the message "itunes cannot read the contents of the iphone" and asking me to restore to factory settings when attaching to PC. I have songs downloaded from itunes on my PC, and songs and apps downloaded to the iPhone from iTunes too. How do I restore to factory setting AND retain the tunes and apps on the phone or get them synched? The iPhone is working fine
    iPhone4 v4.2.1 (8C148) (can't update this till above sorted)
    iTunes 10.2.2.12
    Basically, if there is some way of downloading a 2nd copy of tunes/apps already purchased I can resolve my issue, but I don't know if this can be done. Ican't find a FAQ on this. Thanks in advance

    See  Erase your device  Here  >  http://support.apple.com/kb/HT4137
    Go to Settings > General > Reset > Erase all content and settings
    Also... See the wjosten post here...
    https://discussions.apple.com/message/20294697

  • How to delete a project in Oracle apps R12

    Hi
    OS RHEL 5.5
    Database 11.1.0.7
    Applications R12
    Initially I have created a project in oracle apps from wrong template and modified the template then created a project with the same modified template.
    Now the wrong project needs to be deleted so how to delete the project which had been created from wrong template in oracle apps R12 and integrated project with MSP.
    Both the wrong and correct projects are referring to the same template.
    Please help me to delete the project as it is done in production database.
    Rgrd
    Edited by: 955685 on Feb 4, 2013 8:10 AM

    955685 wrote:
    Hi
    OS RHEL 5.5
    Database 11.1.0.7
    Applications R12
    Initially I have created a project in oracle apps from wrong template and modified the template then created a project with the same modified template.
    Now the wrong project needs to be deleted so how to delete the project which had been created from wrong template in oracle apps R12 and integrated project with MSP.
    Both the wrong and correct projects are referring to the same template.
    Please help me to delete the project as it is done in production database.
    Rgrd
    Edited by: 955685 on Feb 4, 2013 8:10 AMPlease see these docs/links.
    Delete Project Functionality not Working [ID 1060648.1]
    PRC: Delete Project Performance Reporting Data Completes With Error ORA-12838 ORA-6512 [ID 748674.1]
    How Can the PA Period Type Be Changed if It Has Been Entered Incorrectly? [ID 881424.1]
    PAXPREPR Unable To Delete Project [ID 874642.1]
    http://www.oracle.com/pls/ebs121/search?word=Delete+AND+Project&format=ranked&remark=quick_search
    Thanks,
    Hussein

  • How to create database link between oracle and SQL Server

    Hello Everyone,
    Here i have Oracle Database 9i and SQL Server 2005 databases.
    I have some tables in sql server db and i want to access from Oracle.
    How to create a database link between these two servers
    Thanks,

    Thanks for Everyone,
    I was struggle with this almost 10 days....
    I created Database link from Oracle to SQL Server
    Now it is fine.........
    Here i am giving my servers configuration and proceedure how i created the db link...@
    Using Generic Connectivity (HSODBC) we can create db link between Oracle and SQL server.
    Machine (1)
    DB Version : Oracle 9.2.0.7.0
    Operating System : HP-UX Itanuim 64 11.23
    IP : 192.168.0.31
    Host : abcdbt
    Machine (2)
    Version : SQL Server 2005
    Operating System : Windows server 2003 x86
    IP : 192.168.0.175
    Host : SQLDEV1
    User/PW : sa/abc@123! (Connect to database)
    Database : SQLTEST (exsisting)
    Table : T (“ T “ is the table existing in SQLTEST database with 10 rows)
    Prerequisites in Machine (2):
    a)     Oracle 10g software
    b)     User account to access SQL Server database (sa/abc@123!)
    c)     Existing SQL Server Database (SQLTEST)
    d) Tables (testing purpose) (T)
    Steps:
    1)     Install Oracle 10.2.0.1 (Only SW,No need of database) *(Machine 2)*
    2)     Create a DSN where your windows Oracle 10g SW resides *(Machine 2)*
    Control panel >> Administrative Tools >> Data Source (ODBC) >> System DSN ADD
    You can follow this link also.....
    http://www.databasejournal.com/features/oracle/article.php/3442661/Making-a-Connection-from-Oracle-to-SQL-Server.htm
    I created DSN as
    DSN name : SQLTEST
    User : SA/abc@123! (Existing user account)
    Host : 192.168.0.175 (machine 2)
    Already I have 1 database in SQL Server with the name SQLTEST
    You can create DSN with different name also (not same as db name also)
    3)     Create a hsodbc init file in $ORACLE_HOME\hs\admin *(Machine 2)*
    Create init<DSN NAME> file
    Ex: initSQLTEST
    Copy inithsodbc to initSQLTEST
    And edit
    initSQLTEST file
    HS_FDS_CONNECT_INFO = SQLTEST    <DSN NAME>*
    HS_FDS_TRACE_LEVEL = OFF*
    save the file....@
    4)     Configure Listener.ora *(Machine 2)*
    LISTENER_NEW =
    (DESCRIPTION_LIST =
    (DESCRIPTION =
    (ADDRESS_LIST =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.175)(PORT = 1525))
    SID_LIST_LISTENER_NEW =
    (SID_LIST =
    (SID_DESC =
    (SID_NAME = SQLTEST) *+< Here SQLTEST is DSN NAME >+*
    (ORACLE_HOME = G:\oracle 10g\oracle\product\10.2.0\db_1)
    (PROGRAM = hsodbc))
    (SID_DESC =
    (SID_NAME = PLSExtProc)
    (ORACLE_HOME = G:\oracle 10g\oracle\product\10.2.0\db_1)
    (PROGRAM = extproc) )
    :> lsnrctl start LISTENER_NEW
    5)     Configure tnsname.ora *(Machine 2)*
    SQLTEST11 =
    (DESCRIPTION =
    (ADDRESS_LIST =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.175)(PORT = 1525))
    (CONNECT_DATA =
    (SERVER = DEDICATED)
    (SERVICE_NAME = SQLTEST))
    (HS=OK)
    :> tnsping SQLTEST11
    If No errors then conti….
    6)     Configure a file *(Machine 1)*
    Cd $TNS_ADMIN ($ORACLE_HOME/network/admin)
    Create a file
    $ vi TEST_abcdbt_ifile.ora
    something=
    (DESCRIPTION=
    (ADDRESS=(PROTOCOL=tcp)(HOST =192.168.0.175) (PORT=1525))
    (CONNECT_DATA=
    (SID=SQLTEST))
    (HS=OK)
    $ tnsping something
    $ sqlplus system/manager
    Your connected to Oracle database *(machine 1)*
    create database link xyz connect to “sa” identified by “abc@123!” using ‘SOMETHING’;
    select * from t@xyz;10 rows selected.
    Thanks,
    Edited by: ram5424 on Feb 10, 2010 7:24 PM

  • How to delete email from iPhone ONLY and not from server?

    Hi. I have a Yahoo! POP mail account.. Can anyone advise me how to setup my iPhone so it ONLY deletes email from the iPhone and NOT the server. So, after I read an email on the iPhone and delete it, the email remains in the INBOX on the server? If not, I will send a feedback to Apple. BTW - I can dl and send email just fine. Thank you.

    ampullae,
    When you setup Yahoo on the iPhone it defaults to IMAP because Yahoo offers free IMAP Push for iPhone users, as discussed in this article:
    http://docs.info.apple.com/article.html?artnum=305882
    If you add your Yahoo account as "other" it will be setup as POP.
    With IMAP messages are stored on the server, and messages created in one email client, such as the iPhone, show up in the sent mailbox on both. In addition messages moved to a different folder on the iPhone, will be in a different folder when you access your Yahoo mail via a web browser or another IMAP client. Likewise message you delete, will also be synchronized and deleted.
    Hope this helps,
    Nathan C.

  • How to delete the videos in Ipod and Itunes ?

    Could you let me know how to delete the videos in Ipod application in my Iphone 4 to release more space ?

    If you don't want the video on your iphone then uncheck the video in itunes and sync your phone. If you want it removed from both the phone and itunes delete it from itunes and sync your phone.

  • How do you combine mutable iphoto libraries and clean up duplicates

    how do you combine multiple iphoto libraries and clean up duplicates

    If not the only answer is the paid version of iPhoto Library Manager -http://www.fatcatsoftware.com/iplm/ - and maybe duplicate annihaliator -http://www.macupdate.com/app/mac/18748/duplicate-annihilator
    You must have IPLM as stated - you may also need DA depending on how thing go with the merge
    LN

  • I can't back up my information to iCloud and sync them to my iPad. I tried to reset the account by erasing everything in the account but the problem is still there. Can someone let me know how to delete everything in my account and start a new backup.

    Hello,
    I'm having probelms backing up my information to my iCloud account. I tried to reset the account and erase everything in my account but the problem is still there. The problem is that my iPhone is not able to complete the backup process and all it is saying a problem occured.
    Someone Pleas let me know how to reset my account, delet everyhting in the Cloud and start a new backup.
    Thanks very much,
    Dalal Tammar

    Welcome to the Apple Community.
    You might try a forced shutdown to begin with, hold down the top and home buttons together until the device shuts down, then restart it.
    First check that your device is correctly connected to the wifi/internet (settings > wifi)
    If your back up continually fails, you might try turning off back up on your mobile device (settings > iCloud > storage & backup) and then deleting the backup file from iCloud by swiping the backup file on the mobile device (settings > iCloud > storage & backup > manage…) and then turning back up on again.
    If this doesn't help, try turning off some items for back up in a pattern to try to establish if your problem is being caused by specific data on your device.
    Being able to back up to the cloud can be very useful, especially if you don't have access to a computer or have infrequent access to one, however unless you specifically need to use iCloud for back up, you will find backing up to iTunes significantly more convenient and possibly more reliable.
    More about iCloud v iTunes Back Up

Maybe you are looking for

  • Error while cancelling confirmation...

    Hi ,       I am trying to cancel a production order,there are 3 operations-10,20,30. I cancelled 10 and 20,when  I try to cancel operation 30 I get this error. Please give your suggestions. Activity  cannot be entered Message no. RU120 Diagnosis In t

  • LabVIEW Programmer Position in Salt Lake City, UT - Urgent Need

    Be a Programmer for a large national healthcare company that has a reputation unlike any other in the medical industry. This is your chance to be partnered with a reputable, global organization—and have the earning and benefits potential as a top con

  • Third Party WebService call: SOAP Lookup vs SOAP Adapter Scenario.

    Hello Experts, What are the pros and cons of using SOAP Look up in Message Mapping for webService call. Previously my scenario was a standard SOAP Adapter Scenario. But it had BPM, so I have designed it via SOAP look up in Message Map to avoid BPM. I

  • Oracle portal Favorites portlet

    Has anyone found a way to default for other users the links in the favorites portlet? Or get rid of the oracle links? We would like to roll this out, but we will not if we cannot even put our default links in there. There are no edit_defaults links a

  • Integrate R3 into External BW

    hi, all experts I'm now planning one SAP ERP project, Our clients have implemented with IBM Datawarehouse and they want to integrate new ERP system into current IBM BW system , My issue is how to convince them we should deploy SAP BW to integrate SAP