Split a string at all times according to a delimiter

Hello

Can I please get help on this.

I need to split the sub string as below: -.

Entry - "AB@CD@EFG".

Output:

AB

CD

EFG

Thank you

with qry (STR) as)

Select "AB@CD@EFG" from double

)

Select the level,

regexp_substr (str, ' [^ @] +', 1, level) asplit

of qry

connect by level<= regexp_count(str,="" '@')="" +="">

LEVEL ASPLIT
1 "AB".
2 "CD".
3 "EFG".

Explanation of the regular expression:

[^@]+

  • [^ @] + matches a single character not present in the list below

    • Quantifier: + between one and unlimited times, as many times as possible, giving necessary [greedy]
    • @ the literal character @.

Tags: Database

Similar Questions

  • How to split a string into several substrings parent using a delimiter

    Hello

    I am forced to split a string into several substrings parent using a delimiter.

    And insert these substrings in variuou of the columns of a table in a row.

    For example. The sting is: ABC * DEF * GHI * JKH *.

    where ' *' is the separator.

    Desired output:

    Col1 Col2 Col3 Col4 Col5

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

    JKH GHI ABC DEF (null)

    Could you please guide me how can I achieve this.

    Thank you

    Bogoss

    Hello Salim,

    Leave the thread for reference... got this excerpt:

    with t as

    (

    Select "c: its: hgfd:1:23" Str

    )

    Select

    REGEXP_SUBSTR (str, ' ([^:] *)(:|$)', 1, 1, null, 1) col1

    , REGEXP_SUBSTR (str, ' ([^:] *)(:|$)', 1, 2, null, 1) col2

    , REGEXP_SUBSTR (str, ' ([^:] *)(:|$)', 1, 3, null, 1) col3

    , REGEXP_SUBSTR (str, ' ([^:] *)(:|$)', 1, 4, null, 1) col4

    , REGEXP_SUBSTR (str, ' ([^:] *)(:|$)', 1, 5, null, 1) col5

    t;

    This code snippet works well, but for the fixed columns. Here are 5 predefined columns.

    But I need to have a logic that I can browse the string any No.. sometimes.

    For example. If I get 3 secondary channels of the parent chain... I need to insert into 3 columns.

    And if I get 6 strings under... I need to insert into 6 columns.

    Could you please help me develop a logic like that.

    I use Oracle database 10g.

    And the data are currently being collected on external table... but I can store in a variable or a column of a database table.

    Thank you

    Bogoss

  • Daylight Saving Format Date/Time String vs get time in seconds

    Hi all

    I have developed a real-time application using a cRIO 9074 which has two loops. The first gathers data and records the time using the module of ' string of Format Date/time ' with the following time sting: '%d/%m/%Y % H: %m ". The output is a sting with mouth/day/year hour: minute.

    The second loop Gets the cRIO time using the module "get Date/Time in Seconds ' and the output of timestamp is sent by a shared variable for an application that is running on a local computer.

    The problem started Sunday last with DST. With the help of MAX I am able to see that the time of cRIO is bad (1 hour less) and that him "automatically adjust clock for daylight saving time" is not checked and gray, so I am not able to change it.

    The time of the first loop by using the "Date and time Format string' returns the time elapsed between the cRIO (1 hour late), however the time of the second loop is OK. I have manually corrected time using MAX, so now the first loop is correct, and the second is now over an hour.

    Any ideas?

    Dear RavensFan, thank you very much for your answer.

    However, this was not the problem. Apparently the result with or without the element of DST is the same. I solved the problem, for now, by changing a parameter not on the function "get Date/Time in Seconds" but on the time stamp indicator.

    By right clicing the indicator and go to the display Format and the advanced editing mode, I have changed the Format string to a universal time container of this: %< %="" h:="" %m="">< t="" %="" ^="">< %="" h:="" %m=""><>

    Apparently the time from the 'get time in seconds' is still an hour longer, but now it is correctly displayed.

  • How to make a list of check boxes where exactly 2 must be selected at all times?

    I want to have a list of checkboxes or radio buttons, where exactly 2 options must be selected at all times. At the present time, the list has between 2-4 options enabled (according to other parts of the program). How is that possible?

    -James

    Sorry if this seems obvious - I couldn't find apparently relevant information on this topic.

    Here's a simple demo using Enums and the disabled items property.  You can extend the method to disable the value 2 and set of waveform to 0 and 1 when necessary (attached to 8.5) PNG of 2011 (not an extract due to p-nodes)

  • splits the string into 3 parts

    Hello

    I have a requirement to split the string into 3 different room example inf.ethz.ch should be subdivided into inf ethz ch in 3 different column

    We have table called email within this column contains all identification of email we need to divide email with dot (.) in different columns and display please suggest how to implement in the query

    Thank you

    Sudhir

    Use REGEXP_SUBSTR:

    SQL > with t as (select ' inf.ethz.ch' double txt)
    2 Select regexp_substr (txt,'[^.] +') part_1,.
    3 regexp_substr (txt,'[^.] +', 1, 2) part_2,.
    4 regexp_substr (txt,'[^.] +' 1, 3) part_3
    5 t
    6.

    BY PARTY PA
    --- ---- --
    INF ethz ch

    SQL >

    Or you can use SUBSTR + Instr.

    SY.

  • How to split a string into columns

    Hi all

    Have a strings like this, where the delimiter is
    10:00 | x1 | 2 | RO | P | Con ausilio  | y1
    10:10 | x2 | 1 | RO |  |  | y2
    10:20 |x3 | 3 |  |  |  | y3
    10:30 |x4 | 3 | RO | N | Con aiuto  | y4
    10:40 |x5 | 1 | RO |  |  | y5
     
    how can I break it up into columns, for example, the first char(before first pipe) insert in first variable, 
    then, after first pipe,  second characters in a other column ans so on
     
    col1 := '10:00';
     
    col2 := 'x1';
    col3 := '2';
    col4:= 'RO';
    col5 := 'P';
    col6 := ' Con ausilio ';
    col7 := 'y1';
     
     
    col1 := '10:10';
    col2 := 'x2';
    .. and so on
     
    Thanks in advance

    Hello

    If you want to split the string str into 7 columns :

    SELECT  TRIM (BOTH FROM REGEXP_SUBSTR (str, '[^|]+', 1, 1))     AS col1
    ,     TRIM (BOTH FROM REGEXP_SUBSTR (str, '[^|]+', 1, 2))     AS col2
    ,     TRIM (BOTH FROM REGEXP_SUBSTR (str, '[^|]+', 1, 3))     AS col3
    ...
    ,     TRIM (BOTH FROM REGEXP_SUBSTR (str, '[^|]+', 1, 7))     AS col7
    FROM     table_x
    ;
    

    If you want to split it inot 7 variables :

    col1 := TRIM (BOTH FROM REGEXP_SUBSTR (str, '[^|]+', 1, 1));
    col2 := TRIM (BOTH FROM REGEXP_SUBSTR (str, '[^|]+', 1, 2));
    col3 := TRIM (BOTH FROM REGEXP_SUBSTR (str, '[^|]+', 1, 3));
    ...
    col7 := TRIM (BOTH FROM REGEXP_SUBSTR (str, '[^|]+', 1, 7));
    
  • split a string into pl/sql

    Hello

    How to split a string and store in an associative array in pl/sql.function

    My string like this

    '1102,1101,1012,1011,1010,1009,1008,1007,1006,10005,1004,1003,1002,1001'
    and assign it to the array list. According to
    can someone please help

    concerning
    r

    You can try the following. Although I recommend, it would be better to write the function code php as a java stored procedure parser and use the result. We have a class defined in Java String Tokenizer.

    -- Define function to split string into tokens
    FUNCTION get_token(
        p_input_string IN VARCHAR2,            -- input string
        p_token_number IN PLS_INTEGER,         -- token number
        p_delimiter    IN VARCHAR2 DEFAULT ',' -- separator character
      )
      RETURN VARCHAR2
    IS
      v_temp_string VARCHAR2(32767) := p_delimiter || p_input_string ;
      v_pos1 PLS_INTEGER ;
      v_pos2 PLS_INTEGER ;
    BEGIN
      v_pos1     := INSTR( v_temp_string, p_delimiter, 1, p_token_number ) ;
      IF v_pos1   > 0 THEN
        v_pos2   := INSTR( v_temp_string, p_delimiter, 1, p_token_number + 1) ;
        IF v_pos2 = 0 THEN
          v_pos2 := LENGTH( v_temp_string ) + 1 ;
        END IF ;
        RETURN( SUBSTR( v_temp_string, v_pos1+1, v_pos2 - v_pos1-1 ) ) ;
      ELSE
        RETURN NULL ;
      END IF ;
    EXCEPTION
      WHEN OTHERS THEN
        RAISE;
    END get_token;
    
    -- Call the above function in loop for a string with N tokens
    DECLARE
          TYPE assoc_arr_str_typ IS TABLE OF VARCHAR2(100) INDEX BY PLS_INTEGER;
          str_arr assoc_arr_str_typ;
    
          v_str VARCHAR2(200) := '1102,1101,1012,1011,1010,1009,1008,1007,1006,10005,1004,1003,1002,1001' ;
          v_token   VARCHAR2(4) ;
          i          PLS_INTEGER := 1 ;
        BEGIN
          LOOP
            v_token := get_token( v_str, i , ',') ;
            EXIT WHEN v_token IS NULL ;
            dbms_output.put_line( v_token ) ;
            str_arr(i) := v_token;
            i := i + 1 ;
         END LOOP ;
      END ;
     /
    

    Published by: GG 24 March 2011 09:51

  • Concatenate and split the string

    Hi all

    Is there some how we can split the string like this "1 | ~ | Diego | Maradona | ~ | Footballer | The Argentina.

    in the table of 3 elements: '1', ' Diego | Maradona', ' football '. The Argentina.

    Here is my code
    public static void main(String args[]){
              System.out.println("========USE SPLIT========== " );
                   String data = "1 |~| Diego|Maradona |~| Footballer|Argentina";
                 String[] items = data.split(" |~| ");
                 for (String item : items)
                 {
                      System.out.println("item = " + item);
                 }
                 StringTokenizer tok = new StringTokenizer(data," |~| ");
                 System.out.println("========USE TOKENIZER========== " );
                 while(tok.hasMoreElements()){
                      System.out.println("item = " + tok.nextToken());
                 }
              
         }
    and put it is:
    = USE SPLIT =.
    Item = 1
    Item = |
    Item = |
    Item = Diego | Maradona
    Item = |
    Item = |
    Item = football | Argentina
    = USE TOKENIZE =.
    Item = 1
    Item = Diego
    Item = Maradona
    Item = footballer
    Item = Argentina

    Published by: mycoffee on February 1, 2011 06:49

    Split() takes a regular expression. ' | ' has a special meaning in regular expressions.

    Try to use

    " \\|~\\| "
    

    as the argument of split()

  • splits the string into documents

    Hello

    I did a query (see regexp) that split a string into records. The problem with the query is the separate in the subquery. Otherwise, it returns millions of records where I expect less than a thousand.
    Meanwhile, I found an other solution (see xmlsequence), but this statement returns the message "ORA-03113: end of file on the communication channel.

    Please advice.

    regexp:
        SELECT smp.sample_id
        FROM
        (
            SELECT sa.sample_id, sau.u_box_code, sau.u_box_position
            FROM lims_sys.sdg sd, lims_sys.sdg_user sdu, lims_sys.sample sa, lims_sys.sample_user sau
            WHERE sd.sdg_id = sdu.sdg_id
            AND sd.sdg_id = sa.sdg_id
            AND sa.sample_id = sau.sample_id
            AND sau.u_padded_out = 'F'
            AND sdu.u_client_type =  decode('#Client#','-1',sdu.u_client_type,'#Client#')
            AND sdu.u_crop_group = decode('#Crop#','-1',sdu.u_crop_group,'#Crop#')
            AND sdu.u_year_of_sample_delivery = decode('#Year#',-1,sdu.u_year_of_sample_delivery,'#Year#')
            AND sdu.u_week_of_processing = decode('#Week#',-1,sdu.u_week_of_processing,'#Week#')
            AND sd.status IN ('V','P','C')
        ) smp,
        (
            SELECT distinct box_code, regexp_substr(box_pos,'[^,]+',1,level) box_pos 
            FROM
            (
                 SELECT p.name box_code, substr(p.description,instr(p.description, 'NP=') + 3) box_pos
                 FROM lims_sys.plate_template pt, lims_sys.plate p, lims_sys.plate_user pu
                 WHERE pt.plate_template_id = p.plate_template_id
                 AND p.plate_id = pu.plate_id
                 AND pt.name = 'Box96'
                 AND p.status IN ('V','P','C')
                 AND p.description like '%NP=%'
                 AND pu.u_client_type = decode('#Client#','-1',pu.u_client_type,'#Client#')
                 AND pu.u_crop_group = decode('#Crop#','-1',pu.u_crop_group,'#Crop#')
                 AND pu.u_year = decode('#Year#',-1,pu.u_year,'#Year#')
                 AND pu.u_week = decode('#Week#',-1,pu.u_week,'#Week#')
             )
             connect by level <= length(box_pos) - length(replace(box_pos,',')) + 1
        ) box
        WHERE smp.u_box_code = box.box_code
        AND smp.u_box_position = box.box_pos
    xmlsequence:
        SELECT smp.sample_id
        FROM
        (
            SELECT sa.sample_id, sau.u_box_code, sau.u_box_position
            FROM lims_sys.sdg sd, lims_sys.sdg_user sdu, lims_sys.sample sa, lims_sys.sample_user sau
            WHERE sd.sdg_id = sdu.sdg_id
            AND sd.sdg_id = sa.sdg_id
            AND sa.sample_id = sau.sample_id
            AND sau.u_padded_out = 'F'
            AND sdu.u_client_type =  decode('#Client#','-1',sdu.u_client_type,'#Client#')
            AND sdu.u_crop_group = decode('#Crop#','-1',sdu.u_crop_group,'#Crop#')
            AND sdu.u_year_of_sample_delivery = decode('#Year#',-1,sdu.u_year_of_sample_delivery,'#Year#')
            AND sdu.u_week_of_processing = decode('#Week#',-1,sdu.u_week_of_processing,'#Week#')
            AND sd.status IN ('V','P','C')
        ) smp,
        (
            SELECT  box_code, trim(x.column_value.extract('e/text()')) box_pos 
            FROM
            (
                 SELECT p.name box_code, substr(p.description,instr(p.description, 'NP=') + 3) box_pos
                 FROM lims_sys.plate_template pt, lims_sys.plate p, lims_sys.plate_user pu
                 WHERE pt.plate_template_id = p.plate_template_id
                 AND p.plate_id = pu.plate_id
                 AND pt.name = 'Box96'
                 AND p.status IN ('V','P','C')
                 AND p.description like '%NP=%'
                 AND pu.u_client_type = decode('#Client#','-1',pu.u_client_type,'#Client#')
                 AND pu.u_crop_group = decode('#Crop#','-1',pu.u_crop_group,'#Crop#')
                 AND pu.u_year = decode('#Year#',-1,pu.u_year,'#Year#')
                 AND pu.u_week = decode('#Week#',-1,pu.u_week,'#Week#')
             ) t, table (xmlsequence(xmltype('<e><e>' || replace(t.box_pos,',','</e><e>')|| '</e></e>').extract('e/e'))) x
        ) box
        WHERE smp.u_box_code = box.box_code

    Hello

    When 'LEVEL '.<= x"="" is="" the="" only="" connect="" by="" condition,="" then="" you="" should="" be="" using="" a="" table="" that="" has="" only="" one="" row,="" like="">

    You can generate a Table of counters (a result set, in fact) who has all the integers that you need and then join one.
    The next thread is an example:
    I don't don't want to mark in plsql

  • SQL / PLSQL to split the string into pieces

    Hi all

    I have a problem of data conversion from the name of one table to another structure.

    for example

    SQL > desc names
    Name Null? Type
    ----------------------------------------- -------- ----------------------------
    TITLE VARCHAR2 (5)
    FNAME VARCHAR2 (20)
    LNAME VARCHAR2 (20)

    SQL > Data desc
    Name Null? Type
    ----------------------------------------- -------- ----------------------------
    FULLNAME VARCHAR2 (50)


    Insert in data values ("SIR I HAVE ONE NAME PARTICULARLY LONG INDEED");
    Insert in the data values ("MINE IS EVEN MORE, ENOUGH RIDICULEMENT so IN FACT");

    Essentially, I need to divide these names long, stored in the 1 field, in the above 3 fields. The trickiest part is however I want to do it in such a way so that if the 1st part of the name fits the 1 5 char field I want to do, otherwise I would divide between 2 fields - once again without splitting a string. The reason behind this is that application will automatically put a space between each field when they appear and I would avoid gaps in the names if possible.

    This baffled me a little if any help would be seriously great... it might not even be a go-er, as it might be too uneconomic with the amount of available space, but I would give it a shot.

    Thank you!
    Adam

    Hi, Adam.

    Use regular expressions:

    INSERT INTO names (title, fname, lname)
    SELECT  RTRIM (REGEXP_SUBSTR ( fullname
                              , '^.{1,5} '
                        )
               )
    ,     REGEXP_REPLACE ( fullname
                     , '(^.{1,5} )?'       ||     -- \1      = optional 1-5-letter word(s)
                           '(.{1,20})'       ||     -- \2       = 1-20 letters
                    '(( .*)|$)'          -- \3-\4 = space (plus anything) or end
                     , '\2'
                     )
    ,     REGEXP_REPLACE ( fullname
                     , '(^.{1,5} )?'       ||     -- \1      = optional 1-5-letter word(s)
                           '(.{1,20}( |$))' ||     -- \2-\3 = 1-20 letters and space or end
                           '(.{1,20})?'       ||     -- \4       = 0-20 letters
                    '(( .*)|$)'          -- \5       = space (plus anything) or end
                     , '\4'
                     )
    FROM     data_table          -- data is not a good name
    ;
    

    Published by: Frank Kulash, August 18, 2009 11:13
    Revised to manage long single word fullname

  • Is BlueTooth must be turned on at all times

    BlueTooth needs to be on at all times on the iPhone to be connected to the iWatch. ? I usually only get on when I am connected to a BT headset because it uses too much stack.

    Yes. Your iPhone and the watch are paired via Bluetooth.

  • can I view all the bookmarks of all time next to my home page, as the old windows 2003 could, I now have windows 7 &amp; firefox 4. I love being able to see all my favorites all the time.

    can I view all the bookmarks of all time next to my home page, as the old windows 2003 could, I now have windows 7 & firefox 4. I love being able to see all my favorites all the time. Edit

    Just hit CTRL + I

  • How to import all times - not only the role of the iPhone camera?

    My hard drive with all my photos are dead. Fortunately I've stored them all on my iPhone. However when I go to import Photos to Mac I can import only photos taken on the device. How to import all times?

    However when I go to import Photos to Mac I can import only photos taken on the device. How to import all times?

    Your photos have been synchronized to the iPhone via iTunes?

    Then the mac cannot import photos from iPhone photos.  Synchronized pictures are not stored in the camera.

    Apple recommends to retrieve the synchronized photo sharing by e-mail.

    Sync photos to your iPhone, iPad, and iPod touch in iTunes - Apple Support

    • You cannot re-import photos synced from your computer to your device to your computer. You can only import photos from your device, or record, in your device to your computer. If you need recover photos synced from your device, send photos of the unit yourself. Then download the photos from the emails on your computer.

    It is heavy, because you cannot share multiple photos at once.

    Look for a third-party application that allows you to transfer pictures, for example http://www.wirelesstransferapp.com/

  • How to get the image complete at all times without losing the old frame in labview

    Hello

    How to create a vi that accept full frame at all times in a list without losing the old that come from a table.

    Sorry - thought you meant a combo Box is not a listbox control.

    Please find attached an example with a multicolumn listbox.

    You need to build an array of information from the line, then insert a new row in the main table.

    I hope this helps.

  • Battery indicator indicates 100% responsible at all times

    My battery indicator Pavilion dv4-2161nr in the lower right corner of the screen shows 100% charged at all times.  When I'm working on the energy of the battery only and I know that the battery indicator continue to show 100%.  After a few hours of work, computer laptop everything stops.  I am able to charge and run indicator on battery for a good time but never changes.  It also shows when the battery is running on current alternative with plugged adapter and the battery is in a State of charging a battery is full.  Any help would be appreciated.

    Hello

    First, shut down the laptop, unplug the power adapter, remove the battery and then hold the Power button for 30 seconds.

    Now, plug in the AC adapter without the battery inserted, start Notepad, open windows control panel, open Device Manager, expand the entry for the battery, on the right, click on and compatible Microsoft ACPI control method battery and select Uninstall - do uninstall not something else here.  When the uninstall is complete, shut down the laptop, unplug the AC adapter, reinsert the battery, then start the computer turned on just the battery.  Windows will automatically reinstall the driver - leave Windows running for a few minutes and see if the battery level decreases as it should.

    Kind regards

    DP - K

Maybe you are looking for

  • Missing failed to retrieve dv7-4270us "Bootmgr."

    I'm trying to fix a computer laptop dv7-4270us for a friend technologically challenged. The hard drive has not 2 months after the expiration of the warranty. I bought a new, larger drive and a set of recovery disc for this model HP. After 6 recovery

  • Windows does not have to open your settings. Access denied.

    I turned on my HP Pavilion (windows xp Media Center), typed my password and waited and waited for my parameters that never came. Instead, I received a Windows Script Host message: "failed to load your settings. Access denied. " This never happened in

  • How to uninstall and reinstall windows media player?

    I have a client who no longer get windows media player to recognize an external WD media player to synchronize instead of play.  The sync option is grayed out.  He has worked in the past and the player is recognized by another computer and synchroniz

  • Vista guard setting external hard drive read-only...

    SP1 Vista Ultimate x 64 My external hard drive (WD Elements 500 GB) guard get the value read-only. I can go in, select all the files, right click > properties and uncheck the 'read only' box, click OK. When I open the drive once again, they are read

  • Donde puedo comprar photoshop cs6 o cs5 version para windows xp 32-bit?

    Donde puedo comprar photoshop cs6 o cs5 version para windows xp 32-bit? Gracias somos 2 users licenses creative cloud para Mac. Pero in 2 equipos antiguos we need esta version.y por ahora estos tienen otros programas euipos're imposible fornuis.Graci