Search for White space within strings

create table emp_dtl
(empname varchar2(23));
Insert into emp_dtl values ('WAYNE');
Insert into emp_dtl values ('JOSEPH KRUPP');     --------- has white space
Insert into emp_dtl values ('YING ZONG LEE');    --------- has white space
Insert into emp_dtl values ('COHEN');
Insert into emp_dtl values ('MARIE');How can i search for empnames which has White space in it? From other OTN threads, I gathered that this has something to do with
chr(32)But i don't know how to put this in LIKE operator.

Hi,
SELECT  *
FROM    emp_dtl
WHERE   REGEXP_LIKE (empname, '\s')
;will look for any kind of whitespace (including spaces, which are CHR (32)).
It may be more efficient to specifically list all the different whitespace characters, and see if the string changes when you remove all of them:
SELECT     *
FROM     emp_dtl
WHERE     empname != TRANSLATE ( empname
                       , 'x ' || CHR (9)     -- CHR (9)  = <tab>
                                      || CHR (10)     -- CHR (10) = <newline>
                             || CHR (13)     -- CHR (13) = <return>
                       , 'x'
;Edited by: Frank Kulash on Jul 12, 2010 8:47 AM

Similar Messages

  • Search for a space within a text field

    Hi All
    I am trying to search for a sapce within a text field but sofar not being very successful. I have used:
    FIND search_str
               IN text_str
               MATCH COUNT  lv_mcnt
               MATCH OFFSET lv_moff.
    where search_str = TYPE c VALUE ' '.
    I am looking a way of searching a character within the string using ABAP (like INSTRING in other languages). If you have similiar codes - Could you please post me a copy - Thanks

    HI
    Check this..
    DATA string7(30) TYPE c VALUE 'This is a little sentence.'.
    WRITE: / 'Searched', 'SY-SUBRC', 'SY-FDPOS'.
    ULINE /1(26).
    SEARCH string7 FOR 'X'.
    WRITE: / 'X', sy-subrc UNDER 'SY-SUBRC',
                   sy-fdpos UNDER 'SY-FDPOS'.
    SEARCH string7 FOR 'itt   '.
    WRITE: / 'itt   ', sy-subrc UNDER 'SY-SUBRC',
                       sy-fdpos UNDER 'SY-FDPOS'.
    SEARCH string7 FOR '.e .'.
    WRITE: / '.e .', sy-subrc UNDER 'SY-SUBRC',
                      sy-fdpos UNDER 'SY-FDPOS'.
    SEARCH string7 FOR '*e'.
    WRITE: / '*e ', sy-subrc UNDER 'SY-SUBRC',
                    sy-fdpos UNDER 'SY-FDPOS'.
    SEARCH string7 FOR 's*'.
    WRITE: / 's* ', sy-subrc UNDER 'SY-SUBRC',
                    sy-fdpos UNDER 'SY-FDPOS'.
    Thanks ,
    Praveen

  • Searching for a substring within a string

    can someone reccomend a simple way to search for a substring within a string and count the number occurences of that substring.
    The substring and the string will be provided as command line parameters.
    Thanks
    gg

    A simple way would be to use the indexOf methods in String:
    http://java.sun.com/j2se/1.5.0/docs/api/java/lang/String.html
    Not sure what this has to do with event handling though :-P

  • Adding white spaces between strings during concatenation in JSTL

    Please provide a way to add white space between strings during concatenation in JSTL.
    I tried the following.
    eg:
    <c:set var="even_odd" value="odd">
    <c:out value="first ${even_odd}"/>
    I want the output string as "first odd ".
    Moreover i am using the above value for generating the class attribute of a row of a table like
    <tr class=<c:out value="first ${even_odd}"/>>
    while printing the value of <c:out value="first ${even_odd}"/> in the page,i am getting correctly as i needed as "first odd".
    But while taking the code of the page while rendering by the browser, it is showing like
    <tr class="first" odd="">
    I think the white space is the problem.
    Please provide any solution or hint.

    <tr class=<c:out value="first ${even_odd}"/>><tr class="first ${even_odd}">

  • How do I search for a word within a web page

    I would like to be able to do a search for a pecific within the page currenly viewed in the browser. Is there a way to do that in Firefox?

    Hi JossefPerl,
    Searching on a page is actually really easy. You can just hit ''CTRL + F'' to use the search feature. You should take a look at the Knowledge Base article on [[Searching within a page]] for more information.
    Hopefully this helps!

  • Tell me Logic for search for duplicate words(or strings) in a large file.

    Search for duplicate words (or strings) in a text file containing one word per line. For each word that occurs more than once in the flat file output should be as follows
    <word> <number of occurrences> <line numbers in the file where the word occurs>
    For example, if the word Hello occurs thrice in a file at lines 100, 178 and 3456 the output should read
    Hello, 3, [100, 178, 3456]

    Incidentally i wrote similar code some days back. You need to do some modifications to get the exact output you want, but i hope it will be of some help.
    One more thing its written using JAVA5
    public class Test
         private static final String COLLECTIONS_TEXT = "C:\\Documents and Settings\\amrainder\\Desktop\\Collections.txt";
         public static void main(String[] args) throws IOException
              findDuplicateWords();
         private static void findDuplicateWords() throws IOException
              Collection<String> words = new LinkedHashSet<String>();
              File file = new File(COLLECTIONS_TEXT);
              StreamTokenizer streamTokenizer = new StreamTokenizer(new FileReader(file));
              int token = streamTokenizer.nextToken();
              while(token != StreamTokenizer.TT_EOF)
                   if(token == StreamTokenizer.TT_WORD)
                        words.add(streamTokenizer.sval);
                   token = streamTokenizer.nextToken();
              System.out.println(words);
    }Cheers,
    Amrainder

  • Searching for numbers in a string

    I am trying to filter passwords stored in a string variable and ensure that they contain at least a number and one capital letter.
    how do you search for numbers in a string and search if that string contains a character in uppercase?

    function checkString(username){
    var userfield = username;
    var valid = '0123456789ABCDEFGHIJKLMN�OPQRSTUVWXYZ'; // define valid characters
    if(!isValid(userfield.value,valid)){
    alert("Invalid user name format");
    userfield.value="";
    userfield.select();
         userfield.focus();
    }else{
    err = 0;
    userfield = userfield.value;
    function isValid(string,allowed) {
    for (var i=0; i< string.length; i++) {
    if (allowed.indexOf(string.charAt(i)) == -1)
    return false;
    return true;
    }

  • Search for a song within a playlist in iTunes 11

    I just want to know how do I search for a song within a playlist. I don't want to search the entire music library just one single playlist.

    Got it. I have to deslect the Search Entire Library in the search field

  • How can I use SQL to search for a pattern within a field?

    Hello, Frank, Solomon, ect
    I am now faced with this particular scenario, I've got the SQL to search through a field to find text within the field, but I have to know what it is before it can look for it.
    What I have to do is this:
    Search through a field, for a pattern, and I won't know what the data is I am looking for. Can this be done in SQL?
    For instance, Here is my SQL this far, I was helped allot in order to get to this point.
    select table_name,
           column_name,
           :search_string search_string,
           result
      from (select column_name,
                   table_name,
                   'ora:view("' || table_name || '")/ROW/' || column_name || '[ora:contains(text(),"%' || :search_string || '%") > 0]' str
              from cols
             where table_name in ('TABLE1', 'TABLE2')),
           xmltable (str columns result varchar2(10) path '.')
    When you execute the above SQL, you have to pass in a value. What I really need is to alter the above SQL, to make it search for a pattern that exist's within the text of the field itself.
    Like for instance, lets say the pattern I am looking for is this" xx-xxxxx-xxxx" and it's somewhere in a field.
    I need to alter this SQL to take this pattern and search through all the schemas and tables to look for this pattern match.
    Can be done?

    When you use something dynamically within a function or procedure, roles do not apply and privileges must be granted directly.  So, you need to grant select on dba_tab_cols directly.  If you want to do pattern matching then you should use regular expressions.  The following example grants the proper privileges and uses regexp_instr to find all values containing the pattern xxx-xxxx-xxxx, where /S is used for any non-space character.  I limited the tables in order to save time and output for the test, but you can eliminate that where clause.
    SYS@orcl> CREATE USER test IDENTIFIED BY test
      2  /
    User created.
    SYS@orcl> ALTER USER test QUOTA UNLIMITED ON USERS
      2  /
    User altered.
    SYS@orcl> GRANT CREATE SESSION, CREATE TABLE TO test
      2  /
    Grant succeeded.
    SYS@orcl> GRANT SELECT ON dba_tab_cols TO test
      2  /
    Grant succeeded.
    SYS@orcl> CONNECT test/test
    Connected.
    TEST@orcl> SET LINESIZE 90
    TEST@orcl> CREATE TABLE table1
      2    (tab1_col1  VARCHAR2(60))
      3  /
    Table created.
    TEST@orcl> INSERT ALL
      2  INTO table1 (tab1_col1) VALUES ('xxx-xxxx-xxxx')
      3  INTO table1 (tab1_col1) VALUES ('matching abc-defg-hijk data')
      4  INTO table1 (tab1_col1) VALUES ('other data')
      5  SELECT * FROM DUAL
      6  /
    3 rows created.
    TEST@orcl> CREATE TABLE table2
      2    (tab2_col2  VARCHAR2(30))
      3  /
    Table created.
    TEST@orcl> INSERT ALL
      2  INTO table2 (tab2_col2) VALUES ('this BCD-EFGH-IJKL too')
      3  INTO table2 (tab2_col2) VALUES ('something else')
      4  SELECT * FROM DUAL
      5  /
    2 rows created.
    TEST@orcl> VAR search_string VARCHAR2(24)
    TEST@orcl> EXEC :search_string := '\S\S\S-\S\S\S\S-\S\S\S\S'
    PL/SQL procedure successfully completed.
    TEST@orcl> COLUMN "Searchword"     FORMAT A24
    TEST@orcl> COLUMN "Table"     FORMAT A6
    TEST@orcl> COLUMN "Column/Value" FORMAT A50
    TEST@orcl> SELECT DISTINCT SUBSTR (:search_string, 1, 24) "Searchword",
      2               SUBSTR (table_name, 1, 14) "Table",
      3               SUBSTR (t.column_value.getstringval (), 1, 50) "Column/Value"
      4  FROM   dba_tab_cols,
      5          TABLE
      6            (XMLSEQUENCE
      7           (DBMS_XMLGEN.GETXMLTYPE
      8              ( 'SELECT ' || column_name ||
      9               ' FROM ' || table_name ||
    10               ' WHERE REGEXP_INSTR
    11                     (UPPER (' || column_name || '),''' ||
    12                  UPPER (:search_string) || ''') > 0'
    13              ).extract ('ROWSET/ROW/*'))) t
    14  WHERE  table_name IN ('TABLE1', 'TABLE2')
    15  ORDER  BY "Table"
    16  /
    Searchword               Table  Column/Value
    \S\S\S-\S\S\S\S-\S\S\S\S TABLE1 <TAB1_COL1>matching abc-defg-hijk data</TAB1_COL1>
    \S\S\S-\S\S\S\S-\S\S\S\S TABLE1 <TAB1_COL1>xxx-xxxx-xxxx</TAB1_COL1>
    \S\S\S-\S\S\S\S-\S\S\S\S TABLE2 <TAB2_COL2>this BCD-EFGH-IJKL too</TAB2_COL2>
    3 rows selected.

  • Search for certain Characters within set of Characters - in a field

    Hello -
    I know a search can be made within a field for a word, but I am not to sure, or I don't know how to accomplish this...To do a search in a field for certain characters within a larger set of charcters.
    For example: I would search, in the Call Description field, for DXXXX within CA0001DXXXXYYY or search for LXXXX within CA0001LXXXXYYY, the X is numeric characters and the Y's are Alpha characters. Can crystal accomplish this....
    Thanks for your gracious help....
    G.

    Like I said earlier, this code:
    If instr({database_field}, 'DXXXX') > 0 then "String Found" else "Not Found"
    cannot be used in a Record Selection formula.
    The following code can be used in the Record Selection formula:
    Instr({database field}, "string") > 0
    If you wish to search for 'D4444' in the field and return records where a match is found, you would use:
    Instr({database field}, "D4444") > 0
    -Abhilash

  • White spaces in strings

    how do i ignore the white space in a string.
    ex:
    String str = this is an example;
    how do i change it into
    String str2 = thisisanexample;

    I didn't mean to insult you or anything. I apologize if you took offence. It's just I am an old school C programmer myself and I when ever I work with Strings I have to remind myself that they are immutable objects with a extensive collection of methods not character arrays in which you can manipulate the characters indiviually. Of course there are no String or StringBuffer objects in C. I was simply referring to the process you recommeded of directly manipulating characters in a StringBuffer as being very C like thing to do. You can draw many parallels between working with a StringBuffer and a char array.
    Finally I don't have the code anymore. It was some time ago and it was just a test case for a specific problem I had not an exhaustive comparison between StringBuffers and String.replace(). Anyway for what its worth most String methods recast as StringBuffers for char manipulations in their implementations and do so quite efficiently. The average java programmer should avoid this practice themselves unless they have a specific need to do so because 9 out of 10 times they will do so less efficiently than the Java.lang.String implementors.
    To avoid this turning into any more of a flame war than it already is, I'll let you have the last word (i.e. I will not be adding anything further to this thread.)

  • How to search for words in a string?

    I have a list of strings that I need to search for instances
    of a certain word (or part of that word) is there a way of doing
    this in flash please?

    Quickest and easiest way to do it is to search through an
    array of manually entered words.

  • How to Search for "(" error  in a string?

    I am trying to search for "(" in a string, however the compiler thinks that I searching for a regular expression, and fails.
    Exception in thread "main" java.util.regex.PatternSyntaxException: Unclosed group near index 1
    Please help me find a way to search for "(" in a string.
    Example:
    String test="This is a test.";
    if (test.matches("(")){
    System.out.println("There is a match")
    I also tried:
    test.matches("\050")
    and test.matches("\(")
    Thank you!

    I also tried:
    test.matches("\050")
    and test.matches("\(")For this particular problem, I think indexOf is a more appropriate solution. However, for future reference, I think what you want to do for parentheses is escape the backslash, not the bracket.
    i.e.
    test.matches("\\(");

  • How do I search for adjacent words within MS WORD?

    I am new to Mac. I need to search WITHIN MS Word Documents for specific phrases. Example: Jim is a good boy. Spotlight will find all documents containing those 5 words, but not those 5 words together. There has to be a way...
    MacBook   Mac OS X (10.4.8)  

    First, thanks, I did. My naive take is that new plug-ins wouldn't be required.
    Second - I don't know about Google finding every document, but it returns some pretty impressive results, and fast (so long as Google indexes the page in the first place of course). You've never used this feature? I do it all the time when I want to see if there's an internet version of a document I have in my hand.
    Here's a random example the feature in action - I went to boingboing.net and snagged a phrase from the October archives: "You should give props to BabyStyle.com for the blue octopus costume". Here's the link to the October page:
    http://boingboing.net/200610_01archive.html
    and here's the link to the successful Google search:
    http://www.google.com/search?num=50&hl=en&lr=&safe=off&c2coff=1&client=firefox-a &rls=org.mozilla%3Aen-US%3Aofficial&q=%22Youshould+give+props+to+BabyStyle.com+for+the+blue+octopuscostume%22&btnG=Search
    Pretty impressive - the internet is a big place!
    Thirdly, there was a program written for OS 9 called "Gopher" that did just that. It was pretty handy. Come to think of it, it may have been written for System 8! It vanished from publication before there was even a web for it to be distributed on, and when I switched to OS X, it wasn't working well under 9. Of course outside of the personal computing realm, there are well known database programs like Lexis and Nexis that perform exact phrase searches on their databases, which are pretty extensive (at least as large as most document collections on most personal computers, I'd venture). In fact if you've never used those programs they have some pretty powerful functions, like searching for any occurrence of a word within so many words of a second target word.
    I'll give you a couple of examples of where phrase searching might come in handy. Suppose I have a collection of e-mails or correspondence (I guess we all do) and I want to find the one in which I facetiously repeated the punchline to the chicken joke - "to get to the other side". (You have to grant I might have a reason for wanting this particular e-mail, okay?) Of course if I search on "get", "other" and "side" I may wind up with four or five hundred results; those are pretty common words. That doesn't help me much. A phrase search,however, will yield, I dunno, three or four documents. Bingo.
    Or, here. I work in an office creating documents all day long. I've been working in this office, on PCs, for 16 years. That's a lot of documents. I may create three dozen or more on a single subject. The documents are all on the same subject and all pretty much have the same words in them. Maybe I've got a single paragraph printed from one of them and want to find the source document. A simple word search will yield back 80% of the lot. A phrase search typed in from the paragraph is almost certainly unique, however, and will give me my document in a blink.
    (Um, I'd have to move all the documents to a Macintosh to do this, but you get the point I hope.)
    Spotlight says it finds "anything anywhere" on your computer. I would use a feature like this *all the time*. Why shouldn't it be able to do it?

  • Is there a way to search for a file within a site defined in Dreamweaver?

    I know you can search for phrases within a file's code, but
    what if I have defined an extremely large site in Dreamweaver with
    thousands of files in it and then I search for a file with the
    phrase "contact" in it? Is there a way to do this in Dreamweaver or
    is there an extension that would add this functionality?

    On Thu, 24 Jan 2008 01:50:58 +0000 (UTC), "MartinUCSD"
    <[email protected]> wrote:
    >I know you can search for phrases within a file's code,
    but what if I have
    >defined an extremely large site in Dreamweaver with
    thousands of files in it
    >and then I search for a file with the phrase "contact" in
    it? Is there a way
    >to do this in Dreamweaver or is there an extension that
    would add this
    >functionality?
    Of course
    Edit | Find and replace
    put in the "content" in the Find box - select Find in Entire
    site and
    click Find all
    ~Malcolm N....
    ~

Maybe you are looking for

  • Adobe kann meine Kreditkarte nicht belasten

    Hi, bekam eben eine Mail von Adobe das meine hinterlegte Zahlungsmittel (Prepaid Kreditkarte) nicht belastet werden kann. Die Karte verfügt aber über genügend Guthaben und eine Transaktion steht auch auf der Adobe Seite wenn ich unter meinem Abo nach

  • Cost centre hierarchy

    What s the purpose of dealing with cost centre hierarchy?(Financial->Cost accounting-> cost centre hierarchy) Where does this actualy fits into?   Regards, vasanthi.

  • Doubt configuring pck

    Hi all, What is the url i need to give 1)when i configure receiver SOAP adapter in XI to send message to PCK. 2) when i configure receiver SOAP adapter in PCK to send message to XI. Which namespace and interface name i need to specify in Sender SOAP

  • MOVED: The PC shuts down by itself

    This topic has been moved to Vista problems. https://forum-en.msi.com/index.php?topic=112008.0

  • N79 system error when opening N-gage

    hi guys, i tried to open my n-gage but it not only will not open, it also displays a 'system error' message. do you guys know why this is and how i can fix it? i believe this only happend after i updated my phone software 3 days ago. this is the firs