How to update duplicate id?

Hi friends,
I have a table EMP with duplicate IDs.
For example:
ID
100
100
200
200
200
To make it unique, I would like to concatenate at the end of each a sequence-no or rownum, like this desired output:
ID
1001
1002
2001
2002
2003
How do I write a sql to do this?
Thanks a lot,
Ms Inday

Hi,
crystal wrote:
Sorry Sol...the ID is varchar2 there is "-" in it like 100-001 :( is there another solution?That's exactly the kind of confusion that is avoided if you post your CREATE TABLE statement.
I think there are less than 10 duplicates each number....This does what you requested:
MERGE INTO  table_x     dst
USING  (
           SELECT  ROWID     AS r_id
        ,        ROW_NUMBER () OVER ( PARTITION BY  id
                                           ORDER BY      NULL     -- ROW_NUMBER requires ORDER BY
                          )     AS seq_num
         FROM    table_x
       )          src
ON     (src.r_id     = dst.ROWID)
WHEN MATCHED
THEN UPDATE
       SET     dst.id     = dst.id || '-' || src.seq_num
;With this technique, you can have 10, or 100, or any number of rows with the same original id. The id column must be long enough to accept the longer values. (If necessary, do an ALTER TABLE to make the column bigger before doing the MERGE.)

Similar Messages

  • How to update duplicate row from table

    Hi,
    how to update duplicate row from table?
    First to find duplicate row then update duplicate row with no to that duplicate row in oracle.
    can you give me suggestion on it?
    Thanks in advance.
    your early response is appreciated...

    In order to find a duplicate row, see:
    http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:1224636375004
    (or search this forum, your question has been asked before)
    In order to update it, just create and use an Oracle sequence, have it start and increment at a value that doesn't exist in your table.
    If that doesn't get you going, post some CREATE TABLE + INSERT INTO statements, and the results you want from them, in other words: a complete testcase.

  • How to update duplicate links

    my (church) website has a number of HTML "Calendar" pages. One page for each month, with easy navigation from one page to another. These pages list services and activities that happen during the month. I retain several previous months' pages as well as future months, so that visitors can see what sort of stuff goes on at the church. On the home page and on several other pages I have a Spry menubar tab named "calendar". Each new month, I edit the menubar tab links to navigate to the current month Calendar page. Is there an easy way to update all these links simultaneously? Or should I direct the menubar links to a single dummy page as an intermediate page that will redirect immediately to the current page (so I only have to edit the dummy page each month)?

    You are not referencing the Library item properly although this is a creative attempt. The correct way to do it (with this example) would be to start with this code on your page containing the spry menubar -
    <li><a href="#">Home</a></li>
    In Design view, select the word "Home" and on the Quick tag selector (at the bottom of the document pane) click on the "<a>" so that the entire link is selected. Then in the Library category of the Assets panel, select ThisMonth.lbi, and click on INSERT at the bottom of the Library pane. And you will have replaced that Home link with the Library item. Your resulting code would look like this -
    <li><!-- #BeginLibraryItem "/Library/ThisMonth.lbi" --><a href="../pages/2013_01.html">Home</a><!-- #EndLibraryItem --></li>
    Now, DW will manage that link for any changes you make to the Library item.

  • With the new update, I can't figure out how to merge duplicate "Faces" files together, so I end up with one location per face.

    With the newest update, I can't figure out how to merge duplicate files in "Faces" (iPhoto).  I have more than one file going for a face, and use to be able to click and drag them into merging.  Can't seem to do it now.  Can anyone please help?  Thanks

    Are you talking about iPhoto or Photos? If Photos, do you mean that Photos has several files for the same person but they are labeled differently and you are trying to merge them as one? If so, then you have to rename one of the files to match the other one with the correct name.  If this is not what you mean then could you explain more clearly what you mean. To give an example if I click on Faces and Photos shows me all named faces in the top and on the bottom there are suggested faces that can be dragged onto a face in the top level to merge.  If you try to merge two face groups in the top level that are the same person but for some reason the faces are labeled differently you have to label them with the name you want to use and then they will automatically merge.

  • How to delete duplicate attribute in on premise server for office 365 dir sync tool

    Hi,
    Please anyone help to how to remove duplicate attribute in on premise server for office 365 dir sync tool .
    While running the dirsync tool iam getting the below error : 
    "Unable to update this object because the following attributes associated with this object have values that may already be associated with another object in your local directory services: [ProxyAddresses smtp:[email protected],SMTP:[email protected];].
     Correct or remove the duplicate values in your local directory.  Please refer to http://support.microsoft.com/kb/2647098 for more information on identifying objects with duplicate attribute value"
    Still i am troubleshooting to reslove this problem . I have run the ID Fix tool there i could see some 10 duplicate errors . Next what should i do , please anyone help me to find it
    Thanks.....

    Hi,
    Please anyone help to how to remove duplicate attribute in on premise server for office 365 dir sync tool .
    While running the dirsync tool iam getting the below error : 
    "Unable to update this object because the following attributes associated with this object have values that may already be associated with another object in your local directory services: [ProxyAddresses smtp:[email protected],SMTP:[email protected];].
     Correct or remove the duplicate values in your local directory.  Please refer to http://support.microsoft.com/kb/2647098 for more information on identifying objects with duplicate attribute value"
    Still i am troubleshooting to reslove this problem . I have run the ID Fix tool there i could see some 10 duplicate errors . Next what should i do , please anyone help me to find it
    Thanks.....

  • How to resolve duplicate reversal in ods and the purpouse of parallelismtab

    how to avoid duplicate reversal in ods and what is the use of parallelism tab in the ods that appear when we click reconstruction tab in ods manage
    basically my requirement is that 
    we are getting transaction data which will pass through the update rules start routine and will be updated into ods
    but in ods we are getting duplicate reversal means the record with latest version should be updated ut we are getting duplicate reversal and our reveue is showing in minus

    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

  • How do you duplicate a form

    i used to be able to duplicate a blank form, have my clients complete and then save under their names. Since this software updated I have not been able to do this. How do you duplicate and rename a file? Does anyone know?

    You're probably using Acrobat if you can duplicate pages like that. This is the Adobe Reader forum...
    To answer your question, though: The only way this can be done automatically, without having to manually rename each field, is to use a Template to spawn new pages. This is something the form's author should have done, but you can do it yourself as well, using some code.

  • How to solve duplicate contents in adobe catalyst

    hello i would like to ask some help on how to solve duplicate contents..is there a code or a module for this? please advise..thanks

    hello there,
    we still have some issues:
    1. how to stop crawling this site http://mangomonkey.worldsecuresystems.com/ coz when i checked the code it has follow,index code. i believe http://www.mangomonkey.com.au and http://mangomonkey.worldsecuresystems.com coz when i updated a text both links has been updated.
    2. To address the duplicate content issue, add rel canonical tag on each page of http://mangomonkey.worldsecuresystems.com/ or http://mangomonkey.com.au/
    - is there is anyway we can do this using modules/addons/plugins that would enable implement this in BC?
    3. how we can put NOINDEX, NOFOLLOW on http://mangomonkey.worldsecuresystems.com/ without affecting or implementing the code to http://mangomonkey.com.au/
    i would like to clarify about what you said in your previous response "BC already has things in place their end to stop those urls being picked up naturally by google so you need to find and document where you have those worldsecuresystems links first up"
    what you mean by 'BC already has things in place their end to stop those urls' ? please advise..thanks

  • How do I duplicate a photo?

    How do I duplicate a photo If i want to make variations of the same picture?

    Select the photo in iPhoto and then share it to the Photo app.
    It will be duplicated and iPhoto will update itself with the duplicated picture.

  • How do I duplicate a sheet while also linking the corresponding cell values?

    How do I duplicate a sheet while also linking the corresponding cell values? 
    I have a page that I want to duplicate, then add to the duplicated spreadsheet, while having the original cells linked so they are updated as I update the original sheet.  I've found tutorials on how to do this on excel, but I'm having trouble doing so on Numbers.

    Hi Millie,
    You wrote:
    "My recipe sheets include two tables. The first calculates the cost per item, the second table takes the original recipe and calculates along with the sales estimates. The latter of these tables are all the same format, so in each one column A lists the ingredient name, column D is the amount needed per week (column E is the unit - oz, pound, etc).    Could I then generate a search for "flour" etc. within column A of each of these tables?  Currently they are all named the "estimated sales" but I could change that."
    Shouldn't need to change the table name, unless the aim is to shorten the formula as written. That's assuming each sheet is named with the item being baked.
    With the same name for all these tables, the cell or range references to cells on these tables will be Recipe (sheet) name::estimated sales::cell or range ref
    With the recipe name used as the Table name (and that name being unique to the document) the sheet name may be omitted from the cell/range address: Recipe name::cell or range ref
    Regards,
    Barry

  • How to update Logic Pro X to 10.1?

    Recently been trying to figure out how to update logic pro x to 10.1.... not really sure how to go about it or where to begin. I purchased it in September of 2013 and not sure that its been updated ever since. When i go to about it says that im running 10.0.3. Also, not sure if this matters but when i go view it on the mac app store it gives me the option to purchase it for $199.99, which i already have. Please help! thanks in advance.

    That only usually happens when the original copy of LPX on your system had been renamed or moved from it's original location (or was in a different User Account on your Mac....) which is why the Mac App Store app couldn't find it to update it....
    Check your system (search the internal drive and any other drives attached,  one at a time)  for other copies of LPX...... using FindAnyFile....
    http://apps.tempel.org/FindAnyFile/
    Search for Logic or LPX or Logic Pro or any other possible name that could be Logic Pro X and see if it finds any other copies... or any duplicates in the Application folder...
    If it does, delete those copies that are not in the Application folder in the root of your system drive... and/or are not named Logic Pro X,   to be on the safe aside and to prevent such an issue occurring again.. in the future.
    Don't forget to empty trash too... after doing all this.
    Glad you got it updated never the less....
    Note: I assume it actually updated LPX to v10.1.1 which is the latest version.... and not v10.1

  • How to prevent duplicate keys in archive database?

    I am struggling with this problem.
    Background: I'm working on a project where I have to make an archive database. The archive database should get
    all data of the operational database. It should even save every update ever made, so it literally contains the entire history of the operational database (this is a must and the whole project revolves around this idea). So this is solved by using Change Data
    Capture. After that the data should go through a staging area and eventually in the data warehouse database. I came out with a solution and worked it out in the prototype and it seemed to be working all fine. I stupidly forgot to include the foreign keys,
    so the archive database didn't have the original structure but it should ofcourse (no wonder it went okay without too much hassle).
    Problem: Because we want to store everything in archive, there will be duplicate primary keys (just for instance,
    many same contact_id's because telephone number changes a couple of times). I thought to solve this by adding a new primary key which says is auto-increment and purely exist to make a record unique. But when it comes to foreign keys, it's impossible. You want
    contact_id to be able to be duplicate and in that case it cannot be a primary key. But foreign key is only able to reference to a primary key or another unique key but not other normal columns.
    Any advice on this? It's an absolute must to store all changes.

    All of you, thanks for replying, I'm happy you're trying to help me out with this problem. 
    Visakh and Louis, thanks that seems like the solution for this case indeed. Yes, the dimensional design appeals more to me as well.
    I read the articles and watched some tutorials. But I can't work it around the solution that I had.
    More background info: I use CDC to track all the changes done in the operational database and SSIS (following one of Matt Mason's tutorials and with a lot of alterations to make it fit for my project). I have this control flow (don't mind that
    error haha):
    (Oh apparently I cannot add images yet, so here's the link for the screenshot:) http://nl.tinypic.com/r/w0p1u0/8
    Basically I create staging tables in my archive database next to my normal archive tables. Then start CDC control task to get the processing range and then it copies everything from the operational database (joined with a few CDC columns) to the staging
    tables. After that the processing range ends so it will only get the rows it hasn't processed before. And then I do some updates on the staging tables and then finally insert everything into the archive tables. The staging tables then can be truncated. After
    this the data will go to the staging area for transformations and then finally at last to the DWH. The reason for having a staging area between the archive and DWH is that the archive will not only be used as source for the DWH but also on it's own. The DWH
    will not contain 100% the same stuff as the archive (like maybe some transformations, extra columns with calculated fields, plus some columns don't need to be in the DWH at all). When all the ETL stuff is done in SSIS, I have to use SSAS to define all the
    facts, dimensions, cubes. 
    Example: So I try to work with the SCD type 2. If I understood it correctly (and maybe I didn't): for example, the contact table in archive should have the surrogate key ID (the auto-increment one). The business key is the contact_id
    and can be used uniquely with the time range columns. 
    Following Visakh's post, the ID becomes the key that the foreign key will reference to. For example: 
    Contact table:
    ID: 1 contact_id: 100
    Name: Glenn start_time: 2014-01-01
    End_time: 2014-08-20
    ID: 2 Contact_id: 100
    Name: Danzig Start_time: 2014-08-20
    end_time: NULL
    Sorry, I couldn't style it as table somehow. So the employee changed his name. It makes sense that the time period tells when the first name was valid. 
    Organisation table: 
    ID: 1
    org_id: 20 
    Contact_id: 1
    Start_time: 2014-01-01
    End_time:NULL
    (it references to ID instead of contact_id as suggested)
    The employee belongs to an organisation. It references 1 which is still old data. But this is the last version of the organisation record. 
    So then I need a table to link the 2: 
    organisation_contact table
    contact_id:100
    org_id: 20
    and then I need another one to join with the surrogate key?
    ID: 1
    org_id: 20
    ID: 2
    org_id: 20
    (Guess it would make more sense to have org_id in the contact table but for now it's an example)
    Problems: I don't quite understand how this works. From the example I saw you have to have another table (the fact table) to link it to the surrogate key. Would this mean I have to have facts and dimension tables in my archive database?
    My intention was actually to have all records of the operational databases (all the updates too) in my archive. And after that create the facts and dimensions in the DWH with SSAS. The example looks like I should do it earlier. 
    I don't know how to combine this with the cdc solution. I want to get all the data by using CDC. Like how every update gets registered in the accompanying CDC table. Then the archive will get the CDC data. But then how to combine this in use with SCD. I
    have the surrogate key in archive (ID) and then I make the start and end time columns. I need to point all references to the ID and then make the other table to keep track of the contact_id (original PK) and another key. At last make another table to track
    all the current data in the fact. 
    Another question: Would you recommend the SCD task in SSIS. I read it was not that great if you have many rows to work with. What would you think is the best method to implement it. 
    Thanks so much again.
    EDIT: What about slowly changing dimensions type 4? It looks like you don't have to change the references of the foreign key then. Why do you prefer 2 over 4?

  • How to update link and import data of relocated incx file into inca file?

    Subject : <br />how to update link and import data of relocated incx file into inca file.?<br />The incx file was originally part of the inca file and it has been relocated.<br />-------------------<br /><br />Hello All,<br /><br />I am working on InDesignCS2 and InCopyCS2.<br />From indesign I am creating an assignment file as well as incopy files.(.inca and .incx file created through exporing).<br />Now indesign hardcodes the path of the incx files in inca file.So if I put the incx files in different folder then after opening the inca file in InCopy , I am getting the alert stating that " The document doesn't consists of any incopy story" and all the linked story will flag a red question mark icon.<br />So I tried to recreate and update the links.<br />Below is my code for that<br /><br />//code start*****************************<br />//creating kDataLinkHelperBoss<br />InterfacePtr<IDataLinkHelper> dataLinkHelper(static_cast<IDataLinkHelper*><br />(CreateObject2<IDataLinkHelper>(kDataLinkHelperBoss)));<br /><br />/**<br />The newFileToBeLinkedPath is the path of the incx file which is relocated.<br />And it was previously part of the inca file.<br />eg. earlier it was c:\\test.incx now it is d:\\test.incx<br />*/<br />IDFile newIDFileToBeLinked(newFileToBeLinkedPath);<br /><br />//create the datelink<br />IDataLink * dlk = dataLinkHelper->CreateDataLink(newIDFileToBeLinked);<br /><br />NameInfo name;<br />PMString type;<br />uint32 fileType;<br /><br />dlk->GetNameInfo(&name,&type,&fileType);<br /><br />//relink the story     <br />InterfacePtr<ICommand> relinkCmd(CmdUtils::CreateCommand(kRestoreLinkCmdBoss)); <br /><br />InterfacePtr<IRestoreLinkCmdData> relinkCmdData(relinkCmd, IID_IRESTORELINKCMDDATA);<br /><br />relinkCmdData->Set(database, dataLinkUID, &name, &type, fileType, IDataLink::kLinkNormal); <br /><br />ErrorCode err = CmdUtils::ProcessCommand(relinkCmd); <br /><br />//Update the link now                         <br />InterfacePtr<IUpdateLink> updateLink(dataLinkHelper, UseDefaultIID()); <br />UID newLinkUID; <br />err = updateLink->DoUpdateLink(dl, &newLinkUID, kFullUI); <br />//code end*********************<br /><br />I am able to create the proper link.But the data which is there in the incx file is not getting imported in the linked story.But if I modify the newlinked story from the inca file,the incx file will be getting update.(all its previous content will be deleted.)<br />I tried using <br />Utils<IInCopyWorkflow>()->ImportStory()<br /> ,But its import the incx file in xml format.<br /><br />What is the solution of this then?<br />Kindly help me as I am terribly stuck since last few days.<br /><br />Thanks and Regards,<br />Yopangjo

    >
    I can say that anybody with
    no experience could easily do an export/import in
    MSSQLServer 2000.
    Anybody with no experience should not mess up my Oracle Databases !

  • How to update ADF VO object to refresh the data in ADF Pivot table

    I need to know how to update the View object so that the date in pivot table is refreshed/updated/filtered.
    here are the steps I performed to create ADF pivot table application using VO at design time.
    1) created a collection in a Data Control (ViewObject in an ApplicationModule) that provides the values I wanted to use for row and column labels as well the cell values (Used the SQL query)
    2) Dragged this collection to the page in which wanted to create the pivot table
    3) In the pivot table data binding editor specified the characteristics of the rows (which attribute(s) should be displayed in header), the columns (likewise) and the cells.
    Now, I have a requirement to update/filter the data in pivot table on click of check box and my question is how to I update the View object so that the date in pivot table is refreshed/updated/filtered.
    I have got this solution from one of the contact in which a WHERE clause on an underlying VO is updated based upon input from a Slider control. In essence, the value of the control is sent to a backing bean, and then the backing bean uses this input to call the "filterVO" method on the corresponding AppModule:
    but, I'm getting "operationBinding" object as NULL in following code. Please let me know what's wrong.
    here is the code
    Our slider component will look like
    <af:selectBooleanCheckbox label="Unit" value="#{PivotTableBean.dataValue}"
    autoSubmit="true" />
    The setDataValue() method in the backing bean will get a handle to AM and will execute the "filterVO" method in that, which takes the NumberRange as the input parameter.
    public void setDataValue(boolean value) {
    DataValue = value;
    BindingContainer bindings = getBindings();
    OperationBinding operationBinding = (OperationBinding)bindings.getOperationBinding("filterVO");
    Object result = operationBinding.execute();
    The filterVO method in the AMImpl.java will get the true or false and set the where Clause for the VO query to show values.
    public void filterVO(boolean value) {
    if (value != null) {
    ViewObjectImpl ibVO = getVO1();
    ibVO.setWhereClause("PRODUCT_TOTAL_REVENUE(+) where rownum < 10");
    ibVO.executeQuery();
    }

    Did you define a filterVO action in your pagedef.xml file?
    You might want to read on how to access service method from a JSF Web Application in the ADF Developer Guide for 10.1.3 chapter 8.5

  • I have downloaded the latest pages  update on my iPad, but my iMac still has version 4.3 and I cannot find out how to update it only desktop. When I try to send something from my iPad pages to via email to be opened on my desktop in Pages, it won't open P

    I have downloaded the latest pages update on my iPad, but my iMac still has Pages version 4.3, and I cannot find out how to update it on my desktop. When I try to send something from my iPad pages via email to be opened on my desktop in Pages, it won't open in Pages. I get a message that it can't be opened because the version is too old. I sent the document as a PDF and it worked. But I want to be able to use Pages back and forth. HOw do I update the Pages version on my desktop iMac?

    The file format used by the iOS versions of the iWork apps can only be read by the new iWork apps on your Mac - i.e. Keynote 6, Pages 5 & Numbers 3. Those versions for the Mac require Mavericks, OS X 10.9. The "too old" error on a Mac comes if you are trying to open an iWork '08 or earlier file in the newest apps. If you do have the newest apps you can open the files from your iPad.
    If you can't or don't want to upgrade to Mavericks & the newest iWork apps your best option would be to export/share the files from the iPad to a type an older version of iWork can read such as Word, text, Excel, etc.
    Or contact AppleCare. They made this mess, let them fix it.

Maybe you are looking for