List separated by commas in the rows

Hello

Data:

Row1: value, valu2, value3, value4

Row2: Value5, Value6, valu7, value8

Obligation of result:

Row1: value

Row2: value2

Row3: value3

Row4: value4

Row5: Value5

Row6: Value6

Row7: valeur7

Row8: value8

Kind regards

Ngandu

Nordine salvation,

I shook, whereas I try I posted it on the forum so that it could speed up my dev.

in any case, I got the answer in another forum of oracle. You have now the link.

WITH T AS
(
Select 'val1,val2,val3' txt from dual UNION ALL
select 'val65,val66,val67,val68' txt from dual
)
SELECT TRIM(x.COLUMN_VALUE.EXTRACT('e/text()')) cols
  FROM t
      ,TABLE(XMLSEQUENCE(xmltype(''
     || REPLACE(t.txt
               ,','
               ,'')
     || '').EXTRACT('e/e'))) x

Tags: Database

Similar Questions

  • Convert the string separated by commas in the rows

    Dear gurus,

    I want to convert the string separated by commas in the rows to insert in the collection.

    for example, the string 1234,2323,23232,2343,34234
    Higher up in the chain must be converted to ranks in order to insert into the table or the collection

    Thanks in advance
    Sanjeev

    String in rows separated to convert the comma.

    with t
    as
    (
    select '1234,2323,23232,2343,34234' as txt from dual
    )
    select REGEXP_SUBSTR (txt, '[^,]+', 1, level)
      from t
     connect by level <= length(regexp_replace(txt,'[^,]*'))+1
    
  • Count the number of items in a list separated by commas of the values

    Hello friends,

    I have a string with a list of so-called values comma separated

    String v = 34343, erere, ererere, sdfsdfsdfs, 4454, 5454, dsfsdfsfsd, fsdfsdfsdfs, dfdsfsdfsdfs, sdsfdsf, ererdsdsd45454, Sylvie

    You want to count the number of items exist in this string.

    Thank you/Kumar

    Came to my mind as well.
    But I guess I'm typing too slowly, I had other options ran just a second there are tow:

    SQL> with t as (
      2  select  '34343,erere,ererere,sdfsdfsdfs,4454,5454,dsfsdfsfsd,fsdfsdfsdfs,dfdsfsdfsdfs,sdsfdsf,e
    rerdsdsd45454,fsdfsdfs' str from dual
      3  )
      4  --
      5  --
      6  --
      7  select length(str)-length(replace(str, ','))+1
      8  from   t;
    
    LENGTH(STR)-LENGTH(REPLACE(STR,','))+1
    --------------------------------------
                                        12
    
    SQL> with t as (
      2  select  '34343,erere,ererere,sdfsdfsdfs,4454,5454,dsfsdfsfsd,fsdfsdfsdfs,dfdsfsdfsdfs,sdsfdsf,e
    rerdsdsd45454,fsdfsdfs' str from dual
      3  )
      4  --
      5  --
      6  --
      7  select count(*)
      8  from ( select regexp_substr(str, '[^,]+', 1, rownum)
      9         from   t
     10         connect by level <= length(regexp_replace(str, '[^,]+'))+1);
    
      COUNT(*)
    ----------
            12
    
  • Find the occurrence of the word in a list separated by commas

    Hello

    I need to find the first occurrence of a word in a list separated by commas.

    Example list:
    monster,daemon,shark,bambi,sky
    Now I'm looking for the word: bambi
    Result should be the first calculation of the event: 4

    Now I'm looking for the word: Monster
    Result should be the first calculation of the event: 1

    Hope you can help.

    Tobias

    Hi, Tobias,.

    This can be more efficient, because it does not use CONNECT BY or regular expressions. Instead of splitting the string to the level of every comma, just find the target string and count how many commas occur in front of her.

    WITH     got_found_pos          AS
    (
         SELECT     list_txt
         ,     INSTR ( ',' || list_txt || ','
                    , ',bambi,'
                    )          AS found_pos
         FROM    table_x
    )
    SELECT     list_txt
    ,     found_pos + 1
                - LENGTH ( REPLACE ( SUBSTR (list_txt, 1, found_pos)
                                      , ','
                             )
                      )          AS item_num
    ,     found_pos
    FROM    got_found_pos
    WHERE     found_pos     > 0
    ;
    

    Delimited lsits storage is usually a bad idea in a relational database. It is best to store each item in the list on a separate line.

  • Problem using the list separated by commas with nested table element

    Hello

    I have a list separated by commas like this:
    H23004,H24005,T7231,T8231,T9231
    And want to create a function that creates a where clause clause for each element with an output like this:
    UPPER('H23004') IN (UPPER(charge))
    OR UPPER('H23005') IN (UPPER(charge))
    OR UPPER('T7231') IN (UPPER(charge))
    OR UPPER('T8231') IN (UPPER(charge))
    OR UPPER('T9231') IN (UPPER(charge))
    Here's my test function that is not working properly:
    create or replace function FNC_LIST_TO_WHERE_CLAUSE(v_list in VARCHAR2) return varchar2 is
     -- declaration of list type
     TYPE batch_type IS TABLE OF pr_stamm.charge%TYPE;
     -- variable for Batches
     v_batch batch_type := batch_type('''' || replace(v_list,',',''',''') || '''');
     return_script varchar2(1000);
    
     BEGIN
     -- loop as long as there are objects left
     FOR i IN v_batch.FIRST .. v_batch.LAST
     LOOP
       --DBMS_OUTPUT.PUT_LINE(offices(i));
       -- create where clause
       IF i = 1 THEN
         return_script := 'UPPER(' || v_batch(i) || ') IN (UPPER(charge))';
       ELSE
         return_script := return_script || ' OR UPPER(' || v_batch(i) || ') IN (UPPER(charge))';
       END IF;
     END LOOP;
    
     return (return_script);
     end;
    The out put looks like this:
    UPPER('H23004','H24005','T7231','T8231','T9231') IN (UPPER(charge))
    I don't know what I did wrong? It calculates the amount of the incorrect array element! (v_batch. Must be 5)
    v_batch. FIRST = 1
    v_batch. LAST = 1

    Kind regards

    Tobias

    Try this...

    declare
    text varchar2 (1000): = "H23004, H24005, T7231, T8231, T9231;
    v_where varchar2 (1000);
    Start
    Text: = text | «, » ;
    While instr (text, ',') <> 0
    loop
    v_where: = v_where | ' UPPER ("': substr (Text, 1, InStr(Text,',',1)-1) |") ' IN (UPPER (load)) OR ';
    text: = substr (text, instr(text,',',1) + 1);
    end loop;
    v_where: = substr (v_where, 1, length (v_where)-3);
    dbms_output.put_line (v_where);
    end;

    convert it to function...

  • How to get a selected list of a shuttle to a textfield (separated by commas) in the apex?

    Hello

    I use apex 5.

    I used the shuttle to load the list of values of SQL query.now I want to get the list of the selected values on the right side of the shuttle to a textfield.values should be separated by commas.

    Please someone tell me how to do this.

    Thank you

    Hi geslin,.

    Garza says:

    I use apex 5.

    I used the shuttle to load the list of values of SQL query.now I want to get the list of the selected values on the right side of the shuttle to a textfield.values should be separated by commas.

    Please someone tell me how to do this.

    You can do it by using dynamic action.

    Create a dynamic action on the onchange event of your Shuttle point (say P1_SHUTTLE) to get the values to select in the text element (say P1_TEXT) as follows:

    Name: give a name

    Event: change

    Selection type: item (s)

    Article (s): P1_SHUTTLE (select your Shuttle point)

    Condition: is not null

    Action: Execute the PL/SQL Code

    Fire on loading the Page: No.

    PL/SQL code

    BEGIN
      :P1_TEXT := REPLACE(:P1_SHUTTLE,':',',');
    END;
    

    Page items to submit: P1_SHUTTLE

    Page referred to return: P1_TEXT

    Kind regards

    Kiran

  • How to pass variable separated by commas in the bind value of VOquery?

    Version 11.1.1.3.0
    The guys need to help you on this

    I have a VO with query somethg as below

    SELECT *.
    FROM a schema. Table-name
    WHERE (: Bind_Varible has the value null or Column_Name IN (: Bind_Varible))

    User will be be select several values of the screen and I need to pass these value above bind variable.
    But in the variable binding ADF take everything as a single string, then, how can I pass values separated by commas?

    As SELECT *.
    FROM a schema. Table-name
    WHERE (: Bind_Varible has the value null or Column_Name IN (99,55))

    Thank you
    Any help will be appreciated

    I put mine up in this way, my binding variable is a list of values separated by commas, that is to say ("A, B, C, D") (I have a select that many shuttle) then I used a regexp substr to turn them into a list

     WHERE    :Bind_Batch_NM_Comma_Sep_List IS NULL
             OR batch_nm IN
                   (    SELECT REGEXP_SUBSTR (:Bind_Batch_NM_Comma_Sep_List,
                                              '[^,]+',
                                              1,
                                              LEVEL)
                                  batch_nm
                          FROM DUAL
                    CONNECT BY LEVEL <=
                                    REGEXP_COUNT (:Bind_Batch_NM_Comma_Sep_List,
                                                  ',')
                                  + 1)
    

    Published by: pollywog on September 18, 2012 16:07

  • list separated by commas - extraction of each element in an array?

    Is there a quick way to make a field that contains a list of items separated by commas and put them in a table or perhaps separate variables?

    for example.

    a single line in the database contains the field [matches_with] and would generally contain the following elements:

    rings, bracelets, necklaces

    I need to be put in a variable

    < cfset item1 = 'rings' >

    < cfset item2 = 'bracelets' >

    < cfset item3 = necklaces >

    or if its more simple, put them in a table

    agenda [1] = 'rings '.

    point [2] = "bracelets".

    point [3] = "necklaces."

    There is a built-in ListToArray function to CF.

  • Reg. separated by commas of the values in the Text parameter

    Hello

    I tried to keep a text box parameter to contain multiple values by enabling the option 'field contains values separated by commas. But still, in my report, when I gave multiple values, I got the below error.

    ORA-00909: invalid number of arguments


    I have provided the values as below.

    001IB01141130003, 001IB01141170002


    use also all other special characters?


    Thanks in advance.

    Please try this

    Where (AC. TRN_REF_NO IN (: PM_REF_NO) OR LEAST(:PM_REF_NO) IS NULL)

  • How to recover the vales separated by commas in the same column in Oracle SQL

    Dear members

    Please give me the solution for the below question

    Oracle table

    Ename product
    A 1,2,3
    B 1,2,3


    Product column has data like this only separated by commas

    Output should be like this.

    Ename, product
    A 1
    A 2
    A 3
    B 1
    B 2
    B 3

    Can we get the output above using just Oracle SQL select statement?
    I tried in Google I got an answer in SQL server, there is something called "Cross apply split" function, I'm not sure in Oracle.

    Welcome to the forum.

    Here is another interesting site, with lots of useful examples:
    http://asktom.Oracle.com/pls/Apex/f?p=100:11:0:P11_QUESTION_ID:2189860818012 #2654179200346949517

    Also, be sure to read the SQL and PL/SQL FAQ:
    http://forums.Oracle.com/forums/Ann.jspa?annID=1535

  • Transformation list separated by commas (Pages) to isolate the cells inNumbers

    Hello-

    have a nice ewekend arround the world!

    I´ has obtained a letter of information-list discount. It s a comma-sperated pages document. I´d transform these e-mail addresses somehow to singel cell entries in a document numers. When I have a doc plain text export of pages and import it on numbers, I get a lot of lines in the table that appears. These lines are just like cells in the doc pages.

    Any ideas on an automation?

    Thank you!

    Use find and replace to replace commas with tabs, then select, copy and paste into a table of numbers

  • separated by commas of the column values in the row values

    Hi all

    I select data in TABLE A (id number, varchar2 rights). result set under

    RIGHTS OF THE ID

    1 M, P, Y, N, C, P
    4 N, E, HAS
    10 N, C, R, P


    but I want that output voltage


    RIGHTS OF THE ID

    1 M
    2 s
    1. IS
    0 /.
    1 C
    2 s
    4 N
    4 E
    $1
    10 N
    10 C
    10 R
    20 s


    kindly share your idea to get the desired results.


    Thanks in advance

    Edited by: 887268 November 30, 2012 23:12

    Try this

    SQL> WITH a(id, rights) AS
      2  (
      3  SELECT 1, 'M,P,Y,N,C,P' FROM dual UNION ALL
      4  SELECT 4, 'N,E,A' FROM dual UNION ALL
      5  SELECT 10, 'N,C,R,P' FROM dual)
      6  SELECT id, regexp_substr(rights, '[^,]+',1,level) res
      7  FROM a
      8  CONNECT BY  level - 1 <= regexp_count(rights,',')  /*  regexp_count:- 11g */
      9  AND prior id = id
     10  AND prior sys_guid() IS NOT NULL /* sys_guid:- 11g */
     11  ORDER BY id
     12  /
    
            ID RES
    ---------- --------------------------------------------
             1 M
             1 P
             1 Y
             1 N
             1 C
             1 P
             4 N
             4 A
             4 E
            10 N
            10 R
    
            ID RES
    ---------- --------------------------------------------
            10 C
            10 P
    
    13 rows selected.
    

    Thank you!

    Published by: Ashu_Neo on December 1, 2012 21:43
    -Add a comment

  • Counting of string separated by commas in the cells of a column

    Hi all

    Try to pass some of my Excel spreadsheets in numbers. I'd appreciate help with a specific string of text/number in the cells in a column. In the example below (no sheet of complete works) is a column, the packs work (WP01, WP02 and so forth)-which means work packs a particular Test & Validation document (e.g. TV-102) applies to.

    I would like to be able to simple counting the number of occurrences, say "WP05", is applicable. If I use COUNTIF, on the "WorkPack" column, he has only the cells that contain only the string "WP05" (i.e. in the sheet, I work with, I know there are 22 entries for "WP05" in the column of pack work, but only the 14 account)

    Note: I am building this on my MAC, but would like to be able to access and use these sheets on my iPad - don't know if that makes a difference.

    Any suggestions / ideas?

    Thank you in advance...

    ATB Perry

    ID

    Paper group

    WorkPack

    TV-91

    Validation of NFR

    WP05 WP06

    TV-102

    Certificate of conformity

    WP05 WP06

    TV-103

    Validation of NFR

    WP05 WP06

    TV-206

    Test EN

    WP05

    TV-207

    Test EN

    WP05

    TV-208

    Test EN

    WP05

    TV-209

    Test EN

    WP05

    TV-212

    Certificate of conformity

    WP01, WP02 WP03, WP04, WP05, WP06, WP07, WP08 MICROSOFT WINDOWS CURRENTVERSION, WP09, WP10, WP11, WP12, WP13, WP14, WP.15

    TV-213

    Validation of NFR

    WP01, WP02 WP03, WP04, WP05, WP06, WP07, WP08 MICROSOFT WINDOWS CURRENTVERSION, WP09, WP10, WP11, WP12, WP13, WP14, WP.15

    TV-214

    Test EN

    WP01, WP02 WP03, WP04, WP05, WP06, WP07, WP08 MICROSOFT WINDOWS CURRENTVERSION, WP09, WP10, WP11, WP12, WP13, WP14, WP.15

    TV-215

    Validation of NFR

    WP01, WP02 WP03, WP04, WP05, WP06, WP07, WP08 MICROSOFT WINDOWS CURRENTVERSION, WP09, WP10

    TV-308

    Validation of NFR

    WP01, WP02 WP03, WP04, WP05, WP06, WP07, WP08 MICROSOFT WINDOWS CURRENTVERSION, WP09, WP10, WP11, WP12, WP13, WP14, WP.15

    TV-338

    Test EN

    WP05

    Here's how I would approach (without more):

    Add additional columns to your table (those titled "WP01',"WP02", etc.).  Enter the names as shown

    The first line is a heading row.

    Also... Add an extra line at the end and make a footer row

    D2 = (LEN ($C2) −LEN (REPLACE ($C2, D$ 1, ""))) ÷LEN ($1 D)

    It's shorthand dethrone select cell D2 and type e (or copy and paste it here) the formula:

    = (LEN ($C2) −LEN (REPLACE ($C2, D$ 1, ""))) ÷LEN ($1 D)

    Select cell D2, copy

    Select cells D2 the bottom of column R, paste

    in the footer row (row 15 of this example) iff the following formula:

    D15 = Sum (D)

    Select the cell D15, copy

    Select the cells D15 thru R15, dough

    I could never find 22 WP05 instances (even when I search your message on this web page):

  • Entering both the keywords separated by comma

    Does anyone know how to enter keywords for the stock footage at the same time (separated by commas) to the new site of contributor Adobe Stock?

    Thank you for your question. The ability to copy and paste keywords is not a feature that is available at this time. Please note that if you embed your keywords in the metadata of your content before downloading, the system automatically reads the keywords and they will be applied to your presentation files.

    Kind regards

    Mat Hayward

  • Enter several values in the text box, separated by commas and spaces

    Hello

    I have the following syntax as my request to report to the opening of user_names in the area of text separated by commas, but the user sometimes come with a space between commas, could someone please let me know
    How this can be controlled, both when the user uses the space or not use space as well as the comma recording several user names in the text box?
    select 
    *
    from   DW_RFA_JOBDATA
    where  FINISH_TIME >= :P1_START_DATE 
    and FINISH_TIME < :P1_END_DATE
         AND  instr(',' || :P1_USER || ',', ',' || USER_NAME || ',') > 0
     OR (USER_NAME = USER_NAME AND :P1_USER is null)
    Thank you

    Select
    *
    of DW_RFA_JOBDATA
    where FINISH_TIME > =: P1_START_DATE
    and FINISH_TIME<>
    AND instr ("," |) REPLACE (translate (: P1_USER, '! @# $% ^ & * () _-+= {[]}] |------:; ~ ',' '),' ', "). ',', ',' || USER_NAME | ',') > 0
    OR (USER_NAME = USER_NAME AND: P1_USER is null)

Maybe you are looking for