Update records and make them unique

Hi All,
I want to take records from on column and then update another with those records.
But I want the second column to contain unique values:
create table test (a varchar2(10), b varchar2(10))
insert into test (a,b) values ('one',null);
insert into test (a,b) values ('one',null);
insert into test (a,b) values ('two',null);
insert into test (a,b) values ('three',null);
insert into test (a,b) values ('four',null);
insert into test (a,b) values ('five',null);
insert into test (a,b) values ('six',null);
insert into test (a,b) values ('seven',null);
insert into test (a,b) values ('seven',null);
insert into test (a,b) values ('eight',null);
insert into test (a,b) values ('nine',null);
insert into test (a,b) values ('ten',null);
The update should look like this:
one      one(1)
one     one(2)
two     two
three     three
four     four
five     five
six     six
seven seven(1)
seven seven(2)
eight eight
nine     nine
ten     ten

Or...
SQL> merge into test a
  2  using (select rowid rwd,
  3                row_number() over (partition by regexp_replace(regexp_replace(a,' [^[:alnum:]]*', '-'),'^-|-$') order by null) rn,
  4                count(*)     over (partition by regexp_replace(regexp_replace(a,' [^[:alnum:]]*', '-'),'^-|-$') order by null) ct
  5         from   test) b
  6  on    (a.rowid=b.rowid)
  7  when matched then update set a.b=regexp_replace(regexp_replace(a.a,' [^[:alnum:]]*', '-'),'^-|-$')||decode(ct,1,null,'('||rn||')');
15 rows merged.
SQL> select * from test;
A                                                  B
one                                                one(1)
one                                                one(2)
two                                                two
three                                              three
four                                               four
five                                               five
six                                                six
seven                                              seven(1)
seven                                              seven(2)
eight                                              eight
nine                                               nine
ten                                                ten
this is a test of Rob's magic % &&                this-is-a-test-of-Rob's-magic(2)
this is a test of Rob's magic % &                 this-is-a-test-of-Rob's-magic(1)
this is a test of Rob's magic %                   this-is-a-test-of-Rob's-magic(3)
15 rows selected.Nicolas.

Similar Messages

  • Why are my Illustrator images getting thicker strokes when I take the bounding box and make them smaller?

    Why are my Illustrator images getting thicker strokes when I take the bounding box and make them smaller? This has never happened to me. I'm not an expert at Illustrator, but I do know some fundamentals.

    Thank you for responding so quickly. No apologies necessary - I know this Forum isn't McDonalds - don't expect an answer to be served up right away. You helped me out with a big issue yesterday.
    I am using a mac - OSX 10.7.5
    I have Adobe Creative Suites - CS5 - Illustrator version is 15.0.2
    The contents I am placing are all  Vector - Illustrator files
    But, I wonder about some of the vector files I work with.  Could a "line weight/thickness" be 'assigned' to the drawing and screw things up? I used 'simple' linear (line) drawings from SolidWorks that have been converted to ai files. It's just weird because I checked the stroke of the drawing and it's not out of line.
    I am attaching part of some box labels. You can see how the drawings, of the products, on the 'left side' are "thick" after embedding them. I think the "Global Logo" was pasted into a template not linked that's why it's okay. But look at the Quiet Thunder logo - it looks terrible. These labels are only 2.25" X 6.5", so its important I keep the images lightweight. 
    Your help is very much appreciated. Thank you!

  • I was recently prompted to update iPhoto and make changes to the library.  I did it but it keeps hanging up in step 5 or 6 and won't complete the cycle.  I have used force quit, rebooted and started again several times.  How do i get this to work?

    I was recently prompted to update iPhoto and make changes to the library.  I did it but it keeps hanging up in step 5 or 6 and won't complete the cycle.  I have used force quit, rebooted and started again several times.  How do i get this to work?

    Back Up and try rebuild the library: hold down the command and option (or alt) keys while launching iPhoto. Use the resulting dialogue to rebuild.
    If that fails:
    Restore from your back up, repair the Library and try again.

  • HT2470 how would i go about taking multiple files from documents and make them part of 1 master file

    how would i go about taking multiple files from documents and make them into 1 master file? I want to put all documents associated with this project together for easier access.

    From the finder window, click File, click new folder, you can drag all documents into that Folder making it the master folder. You can ajso drag folders into the Master folder, and have them as sub-folders if you wish to  do that. Either way they will all be in one master folder.

  • Will Match remove duplicate songs and duplicate albums and make them into one?

    I have a ton of songs and albums that are like that. Some albums have differnet artwork too. Will match compare these to itunes and make them all unified?

    The only exception is that If it finds an *exact* duplicate (tags and all), it will not upload it; however, it will still leave both copies in your original library (one will have a little cloud with a line through it next to it).

  • How to keep the Sonogram settings and make them "Sticky"?

    I am a Forensic Audio Examiner and would love to use Soundtrack Pro. Does anyone know how to keep the Sonogram settings and make them "Sticky" so you don't have to reset it every time you open up the project?
    Also the Sonogram loses it's frequency range settings while changing the zoom.
    Where is the feedback link for this application?
    Thanks

    are you talking about the spectrum analysis?

  • Access Web Database - Select record and make report with all associated records

    Hey everyone,
    Right now I'm in the middle of trying to convert an Access client database to be web compatible and I'm running into some problems. For this question, I think I may need to explain a little bit about the database:
    The database I'm making is designed to store information about music rights for different songs. The users can input information about writers, producers, organizations, properties, businesses - which is stored all in different related tables. Then, when a
    user inputs a song, they choose which writers, produces, organizations, etc. are affiliated with that song. 
    What I'm trying to do is make a report where you can choose a writer from the list of all the writers and then produce a report with all of the songs by that writer. 
    I was able to do this in the Access client by making a report that, when opened would trigger (using the On Open event) a form to open where you would choose a writer from a combo box and then click a button. When the button was clicked, it would use the value
    in the combo box in a query, which would find all of the songs by that writer and then open up the report which would have the writer and all of their songs on it. 
    Because web reports don't have many event options and web queries are very limited, I have not found a way to make this report.
    Any help at all would be greatly appreciated!

    Hi,
    I found that you've cross post the quesion on our Answer forum, are you satisfiled the reply from there?
    http://answers.microsoft.com/en-us/office/forum/office_2010-access/web-database-select-record-and-make-report-with/04ce4e25-a964-4146-9a34-f9cb26bb0496
    Regards,
    George Zhao
    TechNet Community Support

  • Would like to know how to take itunes and make them caller tunes on iphone

    would like to know how to take itunes on iphone and make them caller tones

    Then type "create iphone ringtones"  or similar into the google search bar.
    You will find several ways to it.
    If you have a Mac as your signature says, then you have posted in the wrong forum - this is the windows forum - and you can use Garageband to make ringtones.

  • How do I best integrate existing laptops for a new server?  Can I use the existing home folders on the laptops and make them into Network Users?

    How do I best integrate existing laptops for a new server?  Can I use the existing home folders on the laptops and make them into Network Users?

    Yes it will work.  I've done it for a few users in my small office.  As with anything, there are quirks that you may or may not experience.  Most quirks are app-related, due to app developers hard-coding absolute paths into their apps for things like temp files (Photoshop).  Strategies for resolving these sorts of quirks can be found via google.  You would probably have seen these quirks already when using server-based home folders for your kids.  If you haven't noticed them, then you're probably fine.
    The tech note you cited should be fine.  It doesn't explicitly say so, but you'll need to enable ssh on your server, at least temporarily, so you can upload your home folder to the server using scp, rsync, etc.  Don't try to copy the files up to the server via Finder.
    Once all your files are transferred to the server and in the right place, make sure to chown them on the server, so they are owned by the userID you created for yourself on the server.
    As with anything this involved, make a good backup of your laptop first.
    Note I have one user that isn't too happy with the responsiveness of the periodic mobile home syncing.  She has about a decade of e-mail in her home folder, probably 50 to 100 emails per day, many with attachments.  Mobile home syncing takes a long time to check and sync this huge tree of itty-bitty files, eevn with server-side file tracking turned on.  The other users are happy.
    The nice thing about mobile home syncing is that when a user "graduates" to an age where they've earned their own laptop, you can change them from a server home user to a mobile home user, with a minimum of fuss.  Also, if you lose or break a laptop, you can add a new replacement laptop to your network, and pull-down a replica of the home folder from the server, with almost no downtime.

  • How do I merge my iTunes libraries and make them accessible from multiple Systems?

    Our family has several Macs using several versions of OSX.
    My Music collection, mostly converted from my large collection of CDs, is scattered across all the Macs and several hard drives with Systems running OSX 10.6.8, 10.8.5 and 10.9.4.
    The older Macs can not be upgraded to either Mountain Lion nor Mavericks.
    My most organised library is the latest on the Mac running Mavericks. It is tidy ALAC, and has all the correct metadata such as covers, composers, ISBNs etc. So I have started by organising those onto an external 1.5 Tb Hard Drive in a folder called Central iTunes Library.
    I intend to then go through the Libraries on the other hard drives and systems and add them to this central external collection.
    1. Will I be able to open the Central Library (created in iTunes 11.2.2) on the older Macs and Systems directly, by plugging in the hard drive?
    2. Is there a better way than reopening the files from the other Systems and Hard Drives and importing them all over again into the Central Library?
         eg Drag and Drop or File > New or a Dedicated Utility for the purpose
    3. Is sharing from my Mac, the only way to let everyone access the library?
    4. Will the other Macs be able to add to the Central Library once it is shared from my Mac?
    5. How do we manage our various iPhones, iPods and iPads with one central Library?
    6. Are there any hazards to watch out for?
    7. What is the best way to have a duplicated backup of the library?
    Thanks,
    Peter

    The concept of a central library sounds great (in principle), but unless you can all follow the same rules about handling playlist/ folder/ genre naming it can get into a mess. Are you sure you want to see all of your son's & wife's music when setting up iOS syncing? I also suspect your son & wife may have a different opinion about accessing all your music (with it's larger ALAC file size) - they may be happier not sifting through all your tracks to find the ones they like for use on iOS?
    The store authorizes to the Mac not the library - so as you move around on each Mac & use your AppleID to purchase that Mac will get tied to that AppleID. That would be fine accept iTunes has a 90 day limit on changing the Apple ID on a computer. You will have to wait 3 months to switch to using another Apple ID to download music & apps on that device - that also affects apps that sync from iOS for backups.
    Personally I think that users need their own Mac with their own library (& each Mac needs to be backed up), especially if they have their own iOS device that needs syncing to a Mac. Home Sharing is ok for moving files that you want to hear from another library - but it can be bad when a client is on wifi.
    iTunes is designed to be a single user who can share over the network - it isn't intended to be one large bucket for every family member to store media, the Apple ID issue makes this pretty clear to me.
    Your flaky wifi issue sounds like a reason not to rely on anything that requires networking to work too.
    You are correct to worry about the library versions, eventually an iTunes update will alter the library format. Only machines that have that version can open the library - this happened from iTunes 10.7 to iTunes 11.
    See how many 'old libraries' you have in the Music/iTunes/Previous iTunes Libraries/ folder - that indicates how many times iTunes has backed up & upgraded the library. Is that more than expected? Major iTunes versions will need to be performed at the same time to keep it all working with the 'central music library'.
    You may be tempted to access one iTunes library over file sharing on multiple Macs. This can cause problems when one Mac updates something (placing a file lock on the library file). It's hit or miss whether the other Macs can read & write to the library.
    PJRS seems to be using a networked iTunes library - I can't understand how it works with iTunes from Tiger to 10.9? What version of iTunes is used PJRS?

  • How to organize apps into folders and make them stick in iphone 3gs?

    Four hours down the drain! Darn, I decided to finally learn how to organize my apps into folders and do it right. Instead I spent four hours and must have got it wrong.
    I opened iTunes on my MacBook with my iPhone attached. Then clicked on the iPhone in the left side list of my iTunes. Then clicked on apps which brought up a nice page with all my iPhone apps listed in one window on the left and all the pages of the apps that are on my iPhone in the window on the right. So far this is what I think the User Manual and Help said to do.
    At that point I created new folders by dragging one app over another. For example, I would find a photography app and drag it onto another photography app. That automatically created a folder with the name photography. Just what I wanted. I then looked for more photography apps and dragged them to the folder.
    This is not too easy because I had eight pages of apps. At first, I would grab an app on a page and drag it to where I knew the corresponding folder would be and put it into the folder.
    Later I found another way was to use the list of my apps on the right to put them in apps.
    In the end, from what appeared on the screen, it seemed to me that most of my apps were in folders and the folders were either on page one, two, or three. At that point I thought that I should sync the MacBook with the iPhone, I believe, and did so.
    When the sync was finished I took the iPhone off the computer and looked at it. NONE of the folders I created, nor the organization into folders of the apps were on my iPhone!
    Obviously, I did something wrong since the same mess was on the iPhone as before, with apps all over the place and impossible to locate without taking too much time. This after four hours of work looking at a 13 in. laptop screen!
    What I hope is that someone smarter than me will look at what I did and tell me where I went wrong.
    I want the apps on the iPhone to be organized into logical folders so it is easier to find them. Something along the lines of a good database, you know?
    Thank you for reading to the end of this question,

    OK, I spent another afternoon doing the job started yesterday. Last night (could not sleep, so might as well think) I got to thinking that I really must have missed a step or something because all my work was done on the Mac and I did not recall any time when I transferred the new setup with folders to the iPhone.
    Sure enough, when I tried it today I did find that missing step. When looking at the Home Page of the iPhone or any page being worked on, in the lower right hand corner two buttons say
    SYNC APPLY
    I do not recall using the APPLY button on the first day trying this, but I used it this time.
    After making changes, I hit APPLY and the computer began to sync with the iPhone.
    This time, although there is nothing telling the user what is going on, the sync actually makes the iPhone pages to look exactly like the pages created on the Mac.
    Too bad the instructions and help did not say to do things in this way, which is the only correct way, as far as I can tell.
    I have about 155 apps on the iPhone, making the job extra lengthy. However, I never could do it on the iPhone’s tiny screen, even though it is possible, so this was good - working on the larger screen of the MacBook.
    There are also some (undocumented?) tricks in using the MacBook for this task. For example, it is possible to create a folder and then, using the list of all apps on the iPhone that is on the left side of screen, open the folder, click on the check box next to any app you want to put in the folder and it will jump right in!
    If the check box already has a check mark, just click the box to remove it, click again to put the check mark in the box and voila the app takes off for the folder. This also works to just put apps onto a certain page, if you want to do that, but dragging apps around sometimes works better.
    I hope it will not be necessary to do this again because of the time involved, and he need for quite a bit of thinking on how to move the apps and folders around to get everything just where you want it on the iPhone. The work reminded me of an old kids game that has a small square case with, I guess eleven movable numbers, that are all mixed up, and one space that is not filled with a number. You can move the little squares with the numbers around inside the case to try to line the numbers up in order from 1-11 and do it faster than anybody else.
    Well, unfortunately lining up all my apps was like that because each page of the iPhone only holds 16 folders or apps and each folder is limited to 12 apps. Starting with 155 apps it takes too much mouse maneuvering to make the process easy.
    Finally, the automatic folder names are very broad, as in MUSIC, LIFESTYLE, SPORTS and such, so I often just deleted the given categories and put my in my own. Also, some day I may break down the folders more because twelve apps in one folder means the apps are still pretty much out of view.
    I wrote this in case anyone else finds it and has the same irksome product. If I just reinvented the wheel, please do not tell me now.

  • About WWDC video style recording and make dvd

    How I can do same way as presentation and speaker in camera on same screen? I believe there is software and hardware make that work.  I use Sony HD camera, Powerpoint or keynote. I would like do WWDC style to record for my client's seminar because look more professional and formal and make DVD. I post example of photo of last WWDC 2014 below..  I hope that save my time and effort than spent many hour to edit and put slide file and speaker's video together and result look crap. How Apple do that?

    You will know that the video of the conference is made by recording the speaker in front of a large ultra high resolution video screen.
    The  streaming video of the conference is made using a video editing application, with an effect called picture in picture, to have two videos playing at the same time.
    To make a similar effect in Keynote, drag and drop two video files, one for the graphic and one of the speaker onto the slide then position and size as required.
    However as you want to create a DVD, edit your video in a video editing application such as Final Cut Pro or iMovie using the Picture in Picture effect, then use  "File > Share" to create the DVD.

  • How can I merge a few projects (not events)and make them 1 long movie?

    I made a whole movie in separated parts- each saved as a project and now i want to merge them. After i combine them into one long project i will need to finalize the edit.
    What is the best way to do that??
    now it is:
    first part-  saved as project 1
    second part-saved as  project 2
    ...-...etc
    I tried to copy all clips and effects from one project and paste them in the next one  but the music timelines get mixed...some of the titles marks disappear and the i movie crashed and quited a few times even though i did it in small portions of about 15 seconds each time ...

    Unfortunately no, in order to do this: SMALL ADJUSTMENTS TO BE DONE IN THE SECOND PART (such as changing the lenth or type of a transition- these are changes that are hard to predict before i see all parts of the movie one after the other)
    You'll have to work back and forth between the Part 2 original project before it gets exported. iMovie doesn't let you combine projects together in an editable, mix and match kind of way. That's one reason it's so inexpensive as compared to a program like Final Cut Pro X which has some ability to combine projects in an editable format. But it's expensive and has a steep learning curve, most likely not an option for many. So it's an unfortunate limit you have bumped up against.

  • Can I develop an iOS app that can download multiple free iBooks that I publish and make them available within the iBooks app?

    Is it possible for a self-developed iOS app to download iBooks from our server and make the books available to the iBooks app?
    My organization is evaluating publishing some free training manuals / textbooks as iBooks made with Apple's "iBooks Author" software. We don't necessarily want to use the iTunes Store for distribution because of the semi-sensitive nature of the content. To distribute the books to users with iPads, we've thought of using MDM software, a webpage, or an iOS app. The reasoning behind an iOS app is that the app would be a "download manager", making it much easier for a user to download all 42 books all at once. A user would install our "free training manual download manager" iOS app and use it to authenticate to a our server app that would serve the books, the end result being the books available via the iBooks app.
    Thanks,
    Ted

    Hi Kappy,
    Actually Apple lets self-publishers distribute iBooks outside of the iTunes Store, as long as the iBooks are free (no cost to user).
    What I'm wondering is if it's possible for a custom iOS app to side-load iBooks so that they're available to a user within the iBooks app.
    If not, we'll either post the iBooks for download from our website or we'll use MDM software to push the iBooks to MDM-enrolled iPads.
    Ted

  • This latest update of Firefox, 5.0.1, has a graphic in the toolbar space that looks like some kind of ad, had HP7 on it, Harry Potter ad maybe, and it obscures my tabs and toolbar and makes them very, very difficult to read, how do I remove it?

    This latest update of Firefox suddenly had this ad (that's what it looks like), for what I am guessing is that it is an ad for a Harry Potter movie, as it says "HP7", (are there really seven of them now??? Wow, talk about overselling something....), but I need to remove it, can't see or read my tabs and tool bar headings, not good! My operating system is Windows XP, tablet PC edition, SP3.

    Is it possible you accidentally installed a Persona? If it's a Persona or other kind of theme, you can revert to the default theme here:
    orange Firefox button ''or'' Tools menu > Add-ons > Appearance
    Right-click default and choose it (your menu choice could say "wear it" or it might say something less strange)
    Any luck?

Maybe you are looking for

  • Converting spool request into multiple pdf formated documents

    Hi Guys,              I am designing a report with several pages of output and running it in background. Is there a possibility to convert each page into an separate pdf format document ? If I use ALV report as output, if its more than page, do I fac

  • How to 'clean' the hard drive before selling

    I just bought a MBP and plan to sell my black MacBook. Is there any way I can be sure all my personal info and settings are set as default. I will transfer my files to the new computer, but what about the settings like network passwords, internet fil

  • Strange Behavior with Data Merge (CS4) - Advice?

    This is the most bizarre behavior and I may have to chalk it up to a full moon or something since I can't reproduce it and I cannot find any hints as why this happened. This is my last attempt at figuring a solution...maybe someone has experienced th

  • Dataguard installation oracle 11gr2 on windows 2008 server

    Hi, I have oracle 11gr2 database on windows 2008 server. I have been given a primary and secondary server with the same setup. Now i want to install dataguard. AFter installing i need to test it for disaster recovery. Can anyone please suggest me a d

  • Using Elements 5 and 8.

    If I install Elements 8, can I still use Elements 5 as my organizer? In another words can I just toggle between the two programs...using my favs from both?    Thanks for any help.