string manipulation: remove duplicates of string

Hello

I'm trying to deduplicate the entries of a string as a delimiter

example of string entry: UV23_I2_P0_NUM; UV23_I2_P1_NUM; UV23_I2_P1_NUM; UV23_I2_P0_NUM; UV24_I4_P0_TXT

example of string output: UV23_I2_P0_NUM; UV23_I2_P1_NUM; UV23_I2_P1_NUM; UV24_I4_P0_TXT

Note the entry in double UV23_I2_P0_NUM in the first string that is removed in the output.

Thank you!
SELECT  distinct
                     REGEXP_SUBSTR ('UV23_I2_P0_NUM;UV23_I2_P1_NUM;UV23_I2_P1_NUM;UV23_I2_P0_NUM;UV24_I4_P0_TXT',
                                    '[^;]+',
                                    1,
                                    LEVEL
                                   ) AS val
                FROM dual
          CONNECT BY REGEXP_SUBSTR ('UV23_I2_P0_NUM;UV23_I2_P1_NUM;UV23_I2_P1_NUM;UV23_I2_P0_NUM;UV24_I4_P0_TXT',
                                  '[^;]+',  1,
                                    LEVEL
                                   ) IS NOT NULL;

Tags: Database

Similar Questions

  • How to remove duplicates from comma separated string


    Hi all

    I have an obligation to remove duplicates of string separated by commas:

    Some examples of code (real data can be in millions)

    {code}

    create table test_dup_del (num number (10), dup_val varchar2 (100));

    insert into test_dup_del values (1234, '1, 2, 3, 4, 3, 1');
    insert into test_dup_del values (4567,'1, 2, 2, 4, 4, 1');
    insert into test_dup_del values (7894,'1, 2, 1, 3, 3, 1');
    insert into test_dup_del values (1478, '1, 2, 4, 4, 3, 2');
    insert into test_dup_del values (2589, '1, 2, 1, 2, 1, 2');
    commit;

    (code}

    my output would be:

    1234, 1, 2, 3, 4'

    4567, '1, 2, 4'

    7894, '1, 2, 3'

    1478, 1, 2, 3, 4'

    2589, 1, 2'

    Thank you

    Rachid

    If there is a real need to split the data so that it could be corrected (before split to store correctly... Tip tip!) ...

    SQL > ed
    A written file afiedt.buf

    1 with test_dup_del (num, dup_val) as)
    2 Select 1234, 1, 2, 3, 4, 3, 1' Union double all the
    3 select 4567, 1, 2, 2, 4, 4, 1' Union double all the
    4 Select 7894, 1, 2, 1, 3, 3, 1' Union double all the
    5 Select 1478, 1, 2, 4, 4, 3, 2' of all the double union
    6 select 2589, 1, 2, 1, 2, 1, 2' of the double
    7      )
    8  --
    9. end of test data
    10-
    11, split as)
    12. Select num
    13, trim (regexp_substr(dup_val,'[^,]+',1,level)) as val
    14 from test_dup_del
    15 connect by num = num prior
    16 and level<=>
    17 and prior sys_guid() is not null
    18                )
    19, dist in (select distinct)
    20                      num
    21                      ,val
    22 split
    23              )
    24 select num
    25, listagg (val, ',') within the Group (order by val) as vals
    dist 26
    27 * group by num
    SQL > /.
    NUM OF VALS
    ---------- ------------------------------
    1234 1,2,3,4
    1478 1,2,3,4
    2589 1.2
    4567 1,2,4
    7894 1,2,3

    5 selected lines.

  • Remove duplicates of the chain

    Hello

    I need help to remove duplicates from a string that contains years and ' - '. Example: 1988-1997-2000-2013-1998-1965-1997-1899

    I know it can be done in regular expressions, but have no experience in this area.

    Select REGEXP_REPLACE (...) of double;

    Thank you

    SQL >-example of production line

    SQL > with t (select ' 1988-1997-2000-2013-1998-1965-1997-1899' double Str)

    2  --

    3 - actual query:

    4  --

    5 Select listagg (str, '-') within the Group (order by null)

    6 from select (separate str

    7 in (select regexp_substr (str, ' [^-] +', 1, rn) str)

    8 t

    9 cross join (select rownum rn

    10 in (select max (length (regexp_replace (str, ' [^-] +'))) + 1 mx)

    11                                    from   t

    12                                  )

    13 connect by level<=>

    14                           )

    15 where regexp_substr (str, ' [^-] +', 1, rn) is not null

    16              )

    17       );

    LISTAGG(STR,'-') WITHINGROUP (ORDERBYNULL)

    -------------------------------------------------------------------------------------------------------------

    1899-1965-1988-1997-1998-2000-2013

    1 selected line.

  • How can I remove duplicate calendars displayed in my list of calendar on my MAC?

    How can I remove duplicate calendars displayed in my list of calendar on my MAC?

    OS X Version of El 10.11.6 (15-1004)

    MacBook Pro (17-inch, mid 2010)

    Intel Core i5 to 2.53 GHz

    4 GB 1067 MHz DDR3

    Macintosh HD

    alexmike,

    Using iCloud? If so, use iCloud: Apple Advanced calendar and troubleshooting iCal - supported

    If this is not the case, what calendars are duplicated?

  • How can I remove duplicates in Photos massively?

    I not only have duplicates in iPhoto and photos, but also in the pictures. In iPhoto, I remove duplicates, why not in the Photos?

    You can certainly - or program will do it for you and two require third-party software - for Photos of some of the programs tested and safe are

    PowerPhotos

    PhotoSweeper for Photos

    Duplicate Annihilator for Photos

    LN

  • the option remove duplicates has been removed!

    I have just been advised by apple to use this option to remove duplicate songs - the option has been removed. Why?

    Hello

    You can always find the duplicates. It was move to file > library > show duplicate items.

    Jim

  • Photo library - iCloud how to remove duplicates

    All, someone knows something about OSX/IOS 'Photos' app will detect and remove duplicates photo9?  My library 'Photos' 63 299 photos & videos of 2135 from may 2016 and at least 10,000 + of these photos are duplicates (based on an analysis of Photosweeper). I have checked the results of the analysis of Photosweeper by doing a manual visual comparison and check images original in iphoto library (using the function location of show) and confirmed that these 10 000 + photos are images duplicate identical with names of different files in different parts of the photo library database.

    So what is happening and how to stop 10-15% of my picture library being duplicate files! I will raise this directly with the apple support payment for the 1 TB icloud service to cover my very large library 'Photos', which should probably be just a large Photo library!

    A few other comments for those who have a double problem:

    -L' old iPhoto application used to "detect duplicates" when import but the new application 'Photos' does not. Anyone know about this?

    -J' saw the documentation from apple saying the icloud search duplicates in 'Photos' when in the icloud, but clearly not work or it does not work if duplicates exist also in the version of the imac to the library 'Photos '.

    -Beware of apps that claim to find 'photos' duplicate and are recommended on various Internet sites, a number of them don't work with the old iphotos app the new application 'Photos' (I discovered after you pay and download). If you need a remover of duplicates of photos that work with 'Photos' review and stay away from any application that do not specify clearly and explicitly he works with "photos" and has been seen since the release of the Photos app.

    + I paid $10 for "Gemini" dual Finder and has been a complete waste of time that didn't work only not with the "Photos" application (it wasn't not clear documentation or support, and when I trigger it supported by Macpaw that they said gemini does not support photos and told me to buy another app macpaw - I told them to go jump in a Lake).

    + I found very good Photosweeper that you can set to match exact or variable (for example photos of accidental burst which are 99.99% identical but 0,1s collapse) and then you can right click to view original file / image in the library to manually check duplicate (if you are paranoid like me) - there are many other paid apps that also make this store then around

    Photos detects duplicates when you import pictures and when you synchronize with ICPL

    Photos does not analyse the duplicates, but checks for them during import and download of IPCL

    There are a few duplicate programs that are tested as safe with Photos, including PowerPhotos, PhotoSweeper for the pictures and Duplicate Annihilator for Photos - do not use a tested and documented as safe\

    And I'm not clear what your post is about since you are asking how to find duplicates and then provide a good answer - photoSweeper - it is one of the safe and effective ways to remove duplicates for Photos

    LN

  • 3.6.2 the numbers help find and remove duplicates in 2 columns

    Could someone help me please. I run a karaoke business. As you may have guessed I have books with many songs, 64 000 and more than 75% of these songs are duplicates so you can imagine by train to sort. Option 1 I could manually go through my list by removing duplicates or option 2 attempt to find a formula that works save me hours of blind deletion. Is there someone out there who can help? It would be much appreciated thanks.

    Here is a sample of the document I'm working.

    Hi robi.

    Here is a solution of Craig s. Ruddock in this discussion Re: duplicates warning formula

    Formula in B2 (fill down)

    = IF (COUNTIF($A,A) = 1",","duplicate")

    Now sort by column A

    Remove all but one of the "duplicate" lines for each song.

    Kind regards

    Ian.

  • Removing duplicates, I usually have to remove the song duplicate twice to make it disappear. Why?

    When you remove duplicate songs, I usually have to remove the song duplicate twice to make it disappear. Why?

    When I delete the duplicate song it pops up again. When I erase it a second time he remains missing.   After the first removal, he reappeared with a little cloud in an arrow down. Once I have remove that she remains missing.

    Is it possible that I can delete a song in one operation?

    iTunes 12.3.3 on Mac Pro Tower

    Looks like you have an iCloud music library, Subscribe to Match iTunes Apple music (or both).  The first time, you probably delete the local copy of the song file (stored on the storage of your computer).  But the song still in your iCloud library, so it appears in your list of music library with the cloud with the arrow symbol (which you can click to download it again).  You can still play the song streaming from iCloud.  The second time, you delete the song completely within your music to iCloud library.

    You can see the distinction if you right click on a song (which is stored locally) in iTunes.  On the shortcut menu that appears, there are two separate, Remove Download and deletecommands.  Remove Download removes the local copy of the song file, but keeps the song in your music to iCloud libraryDelete deletes the song completely, with a single action.

  • How can I remove duplicate songs

    How can I remove duplicate from ITunes songs

    Way the easiest is to change the view songs and then sort the display by the song title. In this way all the duplicated songs appear together.

    To remove the actual songs you can right click on the song and select REMOVE SONG or you can highlight it and press DELETE on your keyboard.

    Just be careful if you remove songs that are physically on your computer that you have a backup copy somewhere - incase you ever want to restore.

  • I have about 14 000 songs in my library, about 4 copies of each of them. Try to remove duplicates, but can only do one at a time. I spent many hours, check all the files I want to delete only to find out that I can't delete them both?

    I have about 14 000 songs in my iTunes library, but really there are only about a quarter as much because there are so many duplicates. I don't know how they got there in the first place, and try to remove them is infuriating! I have already spent several hours going by checking all the files I want to remove (thinking that I would delete then all files at once) - only to find out that I still have to delete them one at a time. There must be a better way! Help, please.

    If you don't know that you want to delete all checked the songs in your library:

    • Create a new smart playlist with the following rules:

      This will show then checked all the songs in your library.
    • Select all the items in this playlist (Ctrl-A)
    • Hold the SHIFT key and press DELETE - follow the prompts to remove songs from your library and (if necessary) your PC media files

    In case of problem, you must back up your library before you do just in case the results are not what you expect - see tips to the user of turingtest2 on your iTunes for Windows with SyncToy to backup library for a suitable and recommended method.

    There is no 'simple' way to reliably remove duplicates from a library, but see the intelligence in this threadon the use of a scripted for removal of duplicates (for example).

    Long-term, try and avoid adding anything in your iTunes library that already exists in it - that's how arise the duplicates (unlike an opinion apparently dispersed, iTunes not of is duplicate anything in normal operation).  I've seen several comments suggesting here a few users to correctly copy their library from an old computer to a new one and then add the content of its media files - guaranteed way to finish with a copy of database entries or media files.

  • How can I quickly remove duplicate photos? High volume of photos in my file on my mac.

    Hello. Y at - it an application that I can download that quickly will allow me to remove duplicate photos that I backed up on my folder in my mac? TIA

    It has dr.cleaner and photos duplicate cleaner. They are both on the Mac app store.

  • Try to remove duplicates, "show exact duplicates" check all instances of some songs

    I'm trying to remove the duplicates in my iTunes (in thousands) library. I view "replica", but for some songs, it checks all instances of the same song, so I can't delete checked without losing these songs in total. Is there a way to fix this, or what I have to go through the entire library of the song?

    Using the latest version of iTunes on a windows PC.  I read the instructions for the removal of duplicates, but my situation is not covered.

    Thank you

    If an entry in a list of audit checks another which makes me suspect that you watch a playlist in which the same elements have been added more than once, rather than the main list of music. The boxes are global in iTunes. One of the phases in my deduper script mentioned below clearly these duplicates of playlist, however, in its current form you need to run it on every playlist where you have this problem if only would you fix this type of problem. For the cleaning of the library to start with the source music in the view of songs and use exact replica. The current version requires counties to disk and the number of titles to match who I'm not sure was always necessary. If you don't see any duplicates that you would expect that maybe why.

    Official notice of Apple on the duplicates is here: find and remove duplicates in your iTunes library. This is a manual process and article fails to explain some of the potential pitfalls such as the lost coast and membership of playlist, or sometimes the same file can be represented by multiple entries in the library as well as a removal and recycling the file will break all the others.

    Use MAJ > view > show items to reproduce exactly to display the duplicates because it is normally a selection more useful. You must manually select all but one of each group to remove. Sort the list by Date added can make easier select appropriate tracks, but it works better when executed immediately after the dupes were created.  If you have several entries in iTunes connected to a same file on the disk hard then don't not send to trash.

    Use my DeDuper script (Windows only) If you are not sure, do not want to do it by hand, or want to maintain ratings, play counts and playlist membership. See this background thread , this post for detailed instructions and Please take note of the warning to back up your library before deduping.

    (If you don't see the menu bar press ALT to temporarily view or CTRL + B to keep displayed.)

    The latest version of the script can put away the dead links as long as there is at least a double live to merge his stats and membership of the playlist and must deal wisely when the same file has been added through multiple paths.

    TT2

  • How to remove duplicate pictures

    I imported all my photos in the photo library. How to remove duplicates of Photos (version 1.3) on OS X El Capitan without 3rd party software?

    Photos don't have a tool to detect the duplicates library. It relies on detecting when you import photos.

    If you intentionally import duplicates, you can only search for them manually, for example by sorting the photos of the capture date, if duplicates will appear side-by-side in moments.

    To search for duplicates, you need third-party software. These three are safe to use with Photos:

  • remove duplicate files

    remove duplicate files

    remove duplicate files

    Yes.  Yes you can.

Maybe you are looking for