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.

Tags: Database

Similar Questions

  • using the function search is not finding the words I know are in my document. Why?

    using the function search is not finding the words I know are in my document. Why?

    The fact that you see a Word does not mean that it is 'real' text. You can select the word? If so, copy and paste in another application (such as Notepad). He always look the same? If the answer to each question is, you also cannot find it by using a search.

  • 1 - where is the search function to find the authors muse a list?

    1 - where is the search function to find the authors muse a list?

    Hello

    Regarding your first question of the creation of a search box in your site from muse, please see this forum post:- Re: how to create a search box in MUSE?

    In addition, you can use different widgets available on Adobe Exchange .

    Now, regarding your second please can question of the creation of a bulleted in Muse, you these tutorials:

    Adobe help Muse | Bullets and numbers

    Bullets and lists numbers | Adobe Muse CC tutorials

    Now, it seems that the Muse version you are using is obsolete and it is possible that you might not find these features in it. I would ask update you your Muse to the latest version 2014.2 using the CC desktop application to take advantage of all these features. Please refer to this screenshot:- http://prntscr.com/55uvs9

    Hope this helps

    Kind regards

    Rohit Nair

  • 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 can I find the word pad and add it to my toolbar for easy access

    I want to use the word pad.  I don't have the icon on my toolbar.  It's not in my menu start, or on my list of programs.  How can I find?  How do I put in my toolbar?  Help shows you your site just click on word pad icon located next to the Home tab.  I'd do it, but he's not here.  Is there a reason why?

    Just type in wordpad in the Windows Explorer search window

    Or try this path "%ProgramFiles%\Windows NT\Accessories\wordpad.exe" in a new shortcut

  • find the word in the query

    Hello

    I want to print the word before _ @.

    request as first of all find the underscore if line _ is printing before _.

    Example:

    [email protected]

    released as:-vinoth

    If not find before underscores @ as

    [email protected]    

    Released as:-Marie Laure

    WITH t AS

    (SELECT "[email protected]" as NAME

    OF THE DOUBLE

    UNION ALL

    SELECT "[email protected]" AS NAME

    THE DOUBLE)

    SELECT THE CHECK BOX

    WHEN INSTR (NAME, '_') = 0

    THEN REPLACE ((SUBSTR (NOM, 1, (INSTR (NOM, ' @'))-1)),)

    '_',

    ''

    )

    WHEN INSTR (NAME, '_') > 0

    THEN SUBSTR (NAME, 1, (INSTR (NAME, '_') - 1))

    END

    T

    Kind regards

    friend

    Post edited by: mostwanted!

    Post edited by: mostwanted!

  • How to find the words that spans end of line to the next line in pdf format?

    I use Adobe Acrobat Pro X version for our development and form maintenance. I am writing a command Acrobat JAVA script which reads through all words and run the spell check and reports the wrong words spelled in an excel sheet. Because I run this script in batch for more than 1000 PDFs - I get a lot of words together. When I looked in the PDF files all these words are good looking because it makes its appearance at the end of the right margin, and the next word is in the next line. Since there is no space between them, it was mined in one word. Where the failure.

    I have used wordf = this.getPageNthWordQuads (i, j) to get the word start and end coordinates. When I look at my values create a rectangle, and extending through the lines. I got the coordinates for the ordinary Word and which cover the two lines acoross. the coordinates are same.

    I think I'm screwed I 8000 words and not the slightest idea how to get rid of them actual misspelled words.

    Help, please. Let me know if any /method class so I give the speech will give me the end of line or I have to go to the next layer to find this split.

    the addnot is somehow marking the words using this contact information - please hellp understand me how this works. Thank you.

    for all pages

    for (var i = 0; i < this.numPages; i ++)

    {

    For all words

    PG += 1;

    numWords = this.getPageNumWords (i);

    for (j = 0; j < numWords; j ++)

    {

    get spell checking

    ckWord = spell.checkWord (this.getPageNthWord (i, j))

    If (ckWord! = null)

    {

    Jn = 0

    ml = 0

    If the misspelled word found.

    wordf = this.getPageNthWordQuads (i, j)

    swordf = wordf.toString)

    var St = swordf.split(",")

    var diffx0 = parseInt(st[0])-8

    var diffx1 = parseInt(st[1])-8

    var diffx2 = parseInt(st[2])-8

    var diffx3 = parseInt(st[3])-8

    var diffx4 = parseInt(st[4])-8

    var diffx5 = parseInt(st[5])-8

    var diffx6 = parseInt(st[6])-8

    var diffx7 = parseInt(st[7])-8

    If (bparole is csword)

    {

    Jn = 1

    }

    If (m [1]! = m [3])

    {

    ml = 1

    }

    dataLine += "\r\n writing".

    }

    on the other

    {

    ml = 2

    }

    dataLine += "\r\n"+this.documentFileName. "

    + "\t" + this.getPageNthWord (i, j)

    + "\t" + pg

    + "\t" + j

    + "\t" + ml

    + "\t" + jn

    '\t st [0]' + diffx0 + '\t m [1]' + diffx1 + '\t st [2]' + diffx2 + '\t [3] st' + diffx3

    '\t st [4]' + diffx4 + '\t st [5]' + diffx5 + '\t [6] st' + diffx6 + '\t st [7]' + diffx7

    CK = 1

    }

    }

    }

    If Acrobat is reading each part of the word and the distinct words, you have a problem.

    The way I approached it in some of my tools was to check if a word ends

    with a hyphen and if so, to check if it is the last one on the line. If the two

    conditions are met, combined with the word on the next line. It comes

    do not fool proof, of course, as there are documents with columns are another

    structural elements that prevent this from working. Better than nothing,

    Although...

    However, it is also possible that Acrobat sees both as parts of

    the same word. In this case, getPageNthWordQuads() returns several

    tables of quads. As you know, this method returns an array of arrays quad.

    He is usually alone, but in principle it could be more... Something

    to check before giving up.

  • [CS3 JS] find the words in the dictionary

    I'm trying to find a way out of the words into syllables.

    The dictionary can break words, but I can't refer to the dictionary to find a Word and its setting.

    The standard I should be able to get the syllables.

    It is possible to recover the hyphenation exceptions, but I need the breaks in the custom dictionary.

    Any thoughts?

    Thank you, Kees

    [Additive] If you need only to be able to manually find the breaking points, you can use an implementation of the algorithm of Knuth-Liang. I wrote in C, and it's pretty good, ah, maybe 80% of the words. For a system purely based on rules, which qualifies as "not too bad".

    There are many free implementations; This is a http://code.google.com/p/hyphenator/ in javascript. (It is targeted on the web pages, but the basics should be transferable to your script.)

  • Find the words (wild cards) using regular expressions

    I'm testing to see if the words are present for revision 1 of a drawing of the cartridge.

    The script search the digit 1 followed by a date, a title, and 4 sets of initials.

    The number 1 is static, (date, title and original are the cards that they are different for each design).

    I use regular expressions to match the words.

    The regular expression highlighted in blue is the number 1 and the date.

    Him remains highlighted in orange does not match the title and initials.

    If anyone can help with the regular expression that is most appreciated.

    Once I got that work will add the form fields for the initials, noting only the console at this point for the tests.

    numWords = this.getPageNumWords (0);

    number of words on the page

    loop through the words on the page

    for (var j = 0; j < numWords-1; j ++)

    {/ / get the pair of words to test}

    ckWords = this.getPageNthWord (0, j) + ' ' + this.getPageNthWord (0, j + 1); test words

    Check if 1 26.05.16 THE STRENGTHENING REVISED MM SB AE GM word string is present

    If (ckWords.match(/ ^ 1\s [0-9] {1,2}.)) [0-9] {1,2}. [0-9] {2} \s\w+(\s+\w+){1,7}/))

    {

    Console.println (ckWords);

    }

    }

    You can use something like this:

    ckWords = this.getPageNthWord (0, j) + ' ' + this.getPageNthWord (j, 0, + 1) + ' ' + this.getPageNthWord (0, + 2 j) + ' ' + this.getPageNthWord (0, j + 3) + ' ' + this.getPageNthWord (0, j + 4) + ' ' + this.getPageNthWord (0, j + 5) + ' ' + this.getPageNthWord (0, j + 6);

    If (! ckWords.match (/ ^ 1\s\d {1,2} \.\d {1,2} \.\d {2} \s\w+ (?:-s + \w +) {1.8} \s([A-Z]{2})\s([A-Z]{2})-s ([A - Z] {2}) \s([A-Z]{2})$ /)) ckWords + ckWords + "" + this.getPageNthWord (0, j + 7);

    If (! ckWords.match (/ ^ 1\s\d {1,2} \.\d {1,2} \.\d {2} \s\w+ (?:-s + \w +) {1.8} \s([A-Z]{2})\s([A-Z]{2})-s ([A - Z] {2}) \s([A-Z]{2})$ /)) ckWords + ckWords + "" + this.getPageNthWord (0, j + 8);

    If (ckWords.match (/ ^ 1\s\d {1,2} \.\d {1,2} {2} \s\w+ \.\d (?:-s + \w +) 1.8 ([A - Z] {2}) \s([A-Z]{2})\s([A-Z]{2})\s {} \s([A-Z]{2})$ /))

    {

    ...

  • Regex to find the word

    Anyone know the regular expression to search for if a variable contains a word has for example this var "Total of surplus percentage of an amount of $2000.00" ".

    I therefore need to know that it contains the word ' Percentage '?

    Here is my code

    cfset xyz =' Total percentage excess in the amount of $2000,00 '

    CFSET foundword = REFind (' percentage ', xyz)

    The above does not work

    Word found at position #foundword #

    Word not found

  • I can't find the mobile link home &gt; list of files

    I can't find mobile link icon in the home tap water > list of files.

    How can I activate my cloud of document in the ms of the acrobat reader

    Please see KB:https://helpx.adobe.com/reader/beta-features/mobile-link.html

    Kind regards
    Rave

  • How to find the word already store in your computer?

    I have Word intalled on my computer but I can find it, can anyone help?

    Hello

    I suggest you follow the procedure below:

    un) Click Start, and then click all programs.

    b) in all programs, you select Microsoft Office.

    c) open Microsoft Office and select Microsoft Word.

  • Sort by or find the word long in a field of varchar2

    Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi
    PL/SQL Release 10.2.0.4.0 - Production
    CORE     10.2.0.4.0     Production
    TNS for HPUX: Version 10.2.0.4.0 - Production
    NLSRTL Version 10.2.0.4.0 - Production
    drop table event;
    create table event  (event_title_nm varchar2(1000));
    
    SET DEFINE OFF;
    Insert into EVENT
       (EVENT_TITLE_NM)
     Values
       ('CREATING A NEW CLASS WORD FOR INDICATOR, - _IN');
    Insert into EVENT
       (EVENT_TITLE_NM)
     Values
       ('Unknown Title');
    Insert into EVENT
       (EVENT_TITLE_NM)
     Values
       ('MASAL REASON TEXT');
    Insert into EVENT
       (EVENT_TITLE_NM)
     Values
       ('Note/Attachment Modifications and Amendments');
    Insert into EVENT
       (EVENT_TITLE_NM)
     Values
       ('Installation (replaces change request  66)');
    Insert into EVENT
       (EVENT_TITLE_NM)
     Values
       ('Unknown Title');
    Insert into EVENT
       (EVENT_TITLE_NM)
     Values
       ('Installation (replaces change request  66)');
    Insert into EVENT
       (EVENT_TITLE_NM)
     Values
       ('List Item Identifier Change');
    Insert into EVENT
       (EVENT_TITLE_NM)
     Values
       ('USER_ID in WORKFLOW_TASK_ASSIGNMENT');
    COMMIT;
    I would like to choose or order by the length of the longer term in the field
    Word defined as characters continued.

    so my production for the first two returned
    event_title_nm
    USER_ID in WORKFLOW_TASK_ASSIGNMENT
    Note/Attachment Modifications and Amendments
    because WORKFLOW_TASK_ASSIGNMENT is the largest word
    and Note/attachment is the second large.

    the reason why I was trying to find thiis is that I display this value in a web page and I need to understand about the longest
    continuous word because the css will not end a text in the middle of a Word. so, it ends up pushing my div set below where I want it to go.

    Published by: pollywog on October 25, 2011 08:43

    You can order by a scalar subquery returns the max length:

    SQL> select *
      2  from event e
      3  order by (
      4             select max(length(regexp_substr(e.event_title_nm, '\S+', 1, level)))
      5             from dual
      6             connect by level <= length(regexp_replace(e.event_title_nm, '\S+'))+1
      7           ) desc
      8  ;
    
    EVENT_TITLE_NM
    --------------------------------------------------------------------------------
    USER_ID in WORKFLOW_TASK_ASSIGNMENT
    Note/Attachment Modifications and Amendments
    Installation (replaces change request  66)
    Installation (replaces change request  66)
    CREATING A NEW CLASS WORD FOR INDICATOR, - _IN
    List Item Identifier Change
    Unknown Title
    Unknown Title
    MASAL REASON TEXT
    
    9 rows selected
     
    
  • Could not find the word on my computer

    Microsoft Word has disappeared from my compupter.  I can't open documents, and I don't know what happened. Any suggestions?

    Did you download AND install?  I mean, once you have downloaded you double-click the file to install?

  • How to find the word or the text of the geometric limits...

    I have a lot of paragraphs in my document and im searching specific word in my document.

    now, what I want to know is, this particular word limits geometric.

    Try this,

    var  myString = doc.textFrames[i].parentStory.contents;
    var  myText = doc.textFrames[i].parentStory.texts[0];
    
    for(j=0;j		   

Maybe you are looking for

  • Multi-port USB adapter for the MacBook USB - C Port?

    Hello I'm in pain, trying to find a USB adapter multi-port for my MacBook 2016, which only has a single port USB - C which is also like a power port. I already done is connect the WD My Passport drive external HARD to the MacBook via an adapter HooTo

  • Could not create Recovery DISK 2

    Hello I just bought a new computer laptop Toshiba Satellite M300/700 and tried to create recovery disks (4 DVD)I managed to create DVDs 1,3 & 4 with No Problem, but couldn't have created the DVD 2.I tried so many times and all failed after about 10 m

  • Buttons stops responding when the event takes place

    I have two independent loops while in a VI. A while loop have a structure of the event. Buttons stop responding when the event takes place. Is there a solution for this problem.

  • Installation SSD as boot in XPS 8900 drive

    I just ordered a 8900 XPS (17, 1 to HDD, 16 GB of ram) which is set for next week (November 5). I bought a new Samsung 850 1 TB SSD which I intend to install and use for the OS and applications. The operating system and the programs will come preload

  • How to rename a directory by using the command prompt

    How can I rename a directory using the command prompt?  Say I want to change c:\Users\User c:\users\user utilisateur\Mes Documents documents.  How can I do this? I looked in Google.  Here's what I found. G:\data>mkdir dir1 G:\data>dir /b dir1 G:\data