Find Charactors in String

Need to know how to only show certain numbers in a string.
Example: NDC#49281-392-15   
I need to only see the numbers and drop the NDC#
Example: Patient tolerated well. NDC#66521-116-11.  This was given at 11/18/13 office visit, could not document. Computers were down. Sandy Wiseman CMA 11/19/2013
I need to drop all characters except 66521-116-11
Trouble is each set of numbers changes and may be a different length.
Some number sets may have "-" while others don't.
Thanks for any help.

DATA code TYPE string VALUE 'NDC#66521-116-11'
DATA first TYPE string.
DATA second TYPE string.
SPLIT code AT '#' INTO first second.
This code will return the following (drops the # symbol):
first = NDC
second = 66521-116-11
Hope this helps.

Similar Messages

  • Find out varchar2 string NULL columns and Empty columns

    Hi dev's ,
    my requiremnt is to find out the string columns Names of whose storing NULL values and EMPTY strings. for that i had written below code. it's getting some error.
    SET ECHO OFF;
    SET FEEDBACK OFF;
    SET SERVEROUTPUT ON;
    SET VERIFY OFF;
    SET PAGES 0;
    SET HEAD OFF;
    spool D:\stringnull.csv
    DECLARE
      v_tab_indent NUMBER(5);
      v_col_indent NUMBER(5);
      v_val1       VARCHAR2(20);
      v_val2       VARCHAR2(20);
      v_query1     VARCHAR(500);
      v_query2     VARCHAR(500);
    BEGIN
      --DBMS_OUTPUT.ENABLE(100000);
      SELECT MAX(LENGTH(table_name))+1,MAX(LENGTH(column_name))    +1
      INTO v_tab_indent,v_col_indent
      FROM user_tab_columns
      WHERE data_type='VARCHAR2';
    FOR i IN
      (SELECT table_name,
        column_name
      FROM user_tab_columns
      WHERE data_type IN ('NVARCHAR2', 'CHAR', 'NCHAR', 'VARCHAR2')
      ORDER BY table_name,
        column_name
      LOOP
        v_query1:='SELECT NVL('||i.column_name||',0) AS VAL    
                  FROM '||i.table_name||' where '||i.column_name||' IS NULL';
        v_query2:='SELECT '||i.column_name||' AS VAL    
                  FROM '||i.table_name||' where '||i.column_name||'=''''';
        --dbms_output.put_line(v_query1);
       -- dbms_output.put_line(v_query2);
        EXECUTE immediate v_query1 INTO v_val1;
        EXECUTE immediate v_query2 INTO v_val2;
        dbms_output.put_line (rpad(i.table_name,v_tab_indent,' ')||','||rpad(i.column_name,v_col_indent,' ')||' ,'||v_val1||','||v_val2);
      END LOOP;
    END;
    Spool OFF
    Set echo on
    Set feedback onERROR:
    Error report:
    ORA-01403: no data found
    ORA-06512: at line 31
    01403. 00000 -  "no data found"
    *Cause:   
    *Action:
    set feedback onpls help me on this issue..
    Thanks,

    Example:
    SQL> DECLARE
      2    v_val       VARCHAR2(20);
      3    v_query1     VARCHAR(32767);
      4  BEGIN
      5   FOR i IN (SELECT table_name, column_name FROM user_tab_columns
      6             WHERE data_type IN ('NVARCHAR2', 'CHAR', 'NCHAR', 'VARCHAR2')
      7             ORDER BY table_name, column_name
      8            )
      9   LOOP
    10     v_query1 := 'SELECT count(*) FROM '||i.table_name||' where '||i.column_name||' IS NULL';
    11     EXECUTE immediate v_query1 INTO v_val;
    12     dbms_output.put_line(rpad(i.table_name,30,' ')||' : '||rpad(i.column_name,30,' ')||' : '||v_val);
    13   END LOOP;
    14  END;
    15  /
    CHILD_TAB                      : DESCRIPTION                    : 0
    DEPT                           : DNAME                          : 0
    DEPT                           : LOC                            : 0
    EMP                            : ENAME                          : 0
    EMP                            : JOB                            : 0
    MYEMP_OLD                      : ENAME                          : 0
    MYEMP_OLD                      : JOB                            : 0
    MYNULLS                        : ENAME                          : 0
    MYNULLS                        : JOB                            : 4
    PARENT_TAB                     : DESCRIPTION                    : 0
    T                              : CHAR_VALUE                     : 0
    TABLE1                         : COL1_DESC                      : 0
    PL/SQL procedure successfully completed.

  • Use REGEXP_INSTR to find a text string with space(s) in it

    I am trying to use REGEXP_INSTR to find a text string with space(s) in it.
    (This is in a Function.)
    Let's say ParmIn_Look_For has a value of 'black dog'. I want to see if
    ParmIn_Search_This_String has 'black dog' anywhere in it. But it gives an error
    Syntax error on command line.
    If ParmIn_Look_For is just 'black' or 'dog' it works fine.
    Is there some way to put single quotes/double quotes around ParmIn_Look_For so this will
    look for 'black dog' ??
    Also: If I want to use the option of ignoring white space, is the last parm
    'ix' 'i,x' or what ?
    SELECT
    REGEXP_INSTR(ParmIn_Search_This_String,
    '('||ParmIn_Look_For||')+', 1, 1, 0, 'i')
    INTO Position_Found_In_String
    FROM DUAL;
    Thanks, Wayne

    Maybe something like this ?
    test@ORA10G>
    test@ORA10G> with t as (
      2    select 1 as num, 'this sentence has a black dog in it' as str from dual union all
      3    select 2, 'this sentence does not' from dual union all
      4    select 3, 'yet another dog that is black' from dual union all
      5    select 4, 'yet another black dog' from dual union all
      6    select 5, 'black dogs everywhere...' from dual union all
      7    select 6, 'black dog running after me...' from dual union all
      8    select 7, 'i saw a black dog' from dual)
      9  --
    10  select num, str
    11  from t
    12  where regexp_like(str,'black dog');
           NUM STR
             1 this sentence has a black dog in it
             4 yet another black dog
             5 black dogs everywhere...
             6 black dog running after me...
             7 i saw a black dog
    5 rows selected.
    test@ORA10G>
    test@ORA10G>pratz
    Also, 'x' ignores whitespace characters. Link to doc:
    http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/conditions007.htm#i1048942
    Message was edited by:
    pratz

  • How can I find out  the strings that will be presented to the UI

    Hi All,
    I am working on a Swing based application (Swing based UI)
    I am requested to do the following on the bytecode of that application:
    I am supposed to find out what strings from within that bytecode will be presented to the UI and what will be used for an internal usage.
    i have no way of running the application to verify that, i can only work on the static bytecode files.
    hard question ha?
    Thanks,
    EItan.

    You would of course have to run it. Either via a VM or recreating a VM yourself.
    As an example of that how would you figure out what string occurs in the following (pseudo) code?
    String msg = (cnt > 1) ? ("files=" + cnt) : ("file=" + cnt);
    if (cnt > 1) DisplayMessage(msg);

  • Finding a Particular string in a Database in the most Optimized way

     Hi All,
              Below is the query to find  a Particular String in the entire database tables,I have a Database of about 500 + tables and each contains many data's .In these tables i want to find a particular
    string but didn't know the column name and table name.so i did as below,but for executing this it almost take 40 - 45 minutes.Is there any other way to Optimize this and make the Query execution Faster.I am copying the code below.Please comment
    DECLARE
        @search_string  VARCHAR(100),
        @table_name     SYSNAME,
        @table_id       INT,
        @column_name    SYSNAME,
        @sql_string     VARCHAR(2000),
     @TableCount    INT,
     @ColumnCount   INT
    SET @search_string = 'Developer'
    DECLARE   @Tables TABLE(Rownumber int identity(1,1),name nvarchar(370),id int)
    DECLARE   @Columns TABLE(Rownumber int identity(1,1),name nvarchar(370),id int)
    INSERT INTO @Tables
    SELECT name, object_id FROM sys.objects WHERE type = 'U'
    SELECT @TableCount=COUNT(1) FROM @Tables
    WHILE (@TableCount >0)
    BEGIN
      SELECT TOP(1)
         @table_name=name
        ,@table_id=id
      FROM  @Tables ORDER BY Rownumber
    INSERT INTO @Columns
    SELECT name,object_id FROM sys.columns WHERE object_id = @table_id AND system_type_id IN (167, 175, 231, 239)
    SELECT @ColumnCount=COUNT(1) FROM @Columns
      WHILE (@ColumnCount >0)
      BEGIN
        SELECT TOP(1)
           @column_name=name
        FROM  @Columns
        WHERE id= @table_id
         ORDER BY Rownumber
         --SET @sql_string = 'IF EXISTS (SELECT 1 FROM ' + @table_name + ' WHERE [' + @column_name + '] LIKE ''%' + @search_string + '%'') PRINT ''' + @table_name + ', ' + @column_name + ''''
          SET @sql_string = 'IF EXISTS (SELECT 1 FROM ' + @table_name + ' WHERE [' + @column_name + '] LIKE ''' + @search_string + '%'') select ''' + @table_name + ''' AS TableName ,  ''' + @column_name
    + ''' AS ColumnName , '''+ @search_string  + ''' As SearchString'
         --select (@sql_string);
          --SET @sql_string = 'IF EXISTS (SELECT 1 FROM ' + @table_name + ' WHERE [' + @column_name + '] = ''' + @search_string + ''') select ''' + @table_name + ''' AS TableName ,  ''' + @column_name
    + ''' AS ColumnName , '''+ @search_string  + ''' As SearchString'
         EXECUTE(@sql_string)
       SET @ColumnCount=@ColumnCount-1
       DELETE FROM @Columns WHERE  Name =   @Column_Name
      END
    SET @TableCount=@TableCount-1
    DELETE FROM @Tables WHERE Name= @Table_Name
    END

    You may also try the below :
    http://gallery.technet.microsoft.com/c0c57332-8624-48c0-b4c3-5b31fe641c58

  • Standard function to find alphabet in string?

    Is there a standard function to find alphabet in string?
    For example, a variable define as char (10),
    I need a function to find out if this variable contains alphabet.
    Any standard function there?

    hiii
    use following code
    data: wa_str(100) type c.
    data: wa_str1 type string.
    data: wa_str2 type string.
    data: wa_str3 type string.
    data: len type i.
    data: ofset type i.
    wa_str = 'ABCD435hjK'.
    len = strlen( wa_str ).
    TRANSLATE wa_str TO UPPER CASE.
    do.
      if ofset = len.
        exit.
      endif.
    if wa_str+ofset(1) co sy-abcde  .
          concatenate wa_str2 wa_str+ofset(1) into wa_str2.
    else.
        concatenate wa_str3 wa_str+ofset(1) into wa_str3.
      endif.
      ofset = ofset + 1.
    enddo.
    write:/ wa_str.
    write:/ 'alphabatic char', 20 wa_str2.
    here TRANSLATE wa_str TO UPPER CASE.
    statement have added .i hope this will solve your problem.
    regards
    twinkal

  • Oracle Spatial function to find nearest line string based on lat/long

    Hi,
    Here is my scenario. I have a table that contains geometries of type line strings (the roadway network). The line geomteries are of type Ohio state plane south (SRID 41104).
    I have a requirement - given a lat/long, find the line string that snaps to that lat/long or the nearest set of line strings within a distance of 0.02 miles.
    This is a typical example of trying to identify a crash location on our roadway network. The crashes being reported to us in lat/long thru the GPS system.
    How can i acheive this through any spatial functions?
    Thanks for the help in advance.
    thanx,
    L.

    Hi L,
    That is not the way I would do it. I would convert my road segments to LRS data, then you can do all queries on the same data.
    Or, if you do not want to modify your original data, create a copy of your road segments with the same ID's and convert the copy into LRS data. If you keep the ID's identical, you can easily use geometry from one and LRS data from the other - as long as you are sure the ID is the same.
    Which will make the workflow a bit easier:
    1. Use SDO_NN to get the closest segments
    2. Use SDO_LRS.PROJECT_PT to get the projected point
    3. Use SDO_LRS.GET_MEASURE to get the measure
    And most of these you can incorporate into one single query. Now I am writing this of the top of my head (It's been a while since I played with LRS). so this has not been tested, but something like this should work (but could probably be greatly improved - it's getting late for me :-) ):
    SELECT
    SDO_LRS.FIND_MEASURE  --//find_measure needs an LRS segment and a point
        SELECT            --//here we select the LRS segment
          r.geometry 
        FROM
          roadsegments r
        WHERE SDO_NN(r.geometry,    --//based on the given GPS point
                     sdo_geometry(2001, 41104, sdo_point_type(lat,lon,NULL), NULL, NULL), 
                     'sdo_num_res=2 distance=0.02 unit=mile') = 'TRUE'
      SDO_LRS.PROJECT_PT  --//We project the point on the LRS segment
          SELECT         --//here we select the LRS segment (again, which could probably be improved!!)
            r.geometry 
          FROM
            roadsegments r
          WHERE SDO_NN(r.geometry,
                       sdo_geometry(2001, 41104, sdo_point_type(lat,lon,NULL), NULL, NULL), 
                       'sdo_num_res=2 distance=0.02 unit=mile') = 'TRUE'
        sdo_geometry(2001, 41104, sdo_point_type(lat,lon,NULL), NULL, NULL) --//The GPS point again
    AS milemarker from dual;So it is not as complicated as you think, it can easily be done with just one query (SQL can do a lot more than you think ;-) ).
    Good luck,
    Stefan

  • Find Substring in String in Workflow

    I'm trying to separate the content from GUID with metadata, but I can't find the Find Substring in String function in SharePoint Designer 2013 mentioned on
    MSDN. Can anyone provide guidance? Thanks!

    Its a not a function. It is workflow action under Actions menu in your SPD 2013. 
    You can find that action under the Utility Actions and make sure you have selected All Actions as show in the image above.
    Amit

  • To find integer in String

    Hi All,
    Can anyone help me in finding integers in string?
    The scenerio is like I have to shortlist the strings which has numbers in it.
    Consider this as a table with following data.
    Ashwin
    Bala12
    Daniel
    Mark67
    Patty.
    i have to get the answer as follows:
    Bala12
    Mark67
    Thanks in advance.

    Hi,
    Hope this code will help :)
    create table my_test (some_val varchar2(100));
    insert into my_test values ('1Abcd2');
    insert into my_test values ('eFgh');
    insert into my_test values ('IjklM');
    insert into my_test values ('nOpq');
    insert into my_test values ('r34st');
    insert into my_test values ('uVw0');
    insert into my_test values ('xyZ');
    insert into my_test values ('!$-#_)(');
    insert into my_test values ('1234567890');
    commit;
    select some_val
      from my_test
    where instr(some_val, '1') + instr(some_val, '2') + instr(some_val, '3') +
           instr(some_val, '4') + instr(some_val, '5') + instr(some_val, '6') +
           instr(some_val, '7') + instr(some_val, '8') + instr(some_val, '9') +
           instr(some_val, '0') > 0;Good luck!
    http://dba-star.blogspot.com

  • How to find the last string value in dynamic object?

    Hi All,
    I am trying to find the last string value in dyanamic objects,Any one have solution for this.
    Ex:
    my data :12347-ebjdone-525-ecgfjf-25236-defdafgdeg
    And i want to show the output is :defdafgdeg
    Any ideas:
    Thanks
    Srini

    For oracle try using oracle function.
    e.g.
    SELECT  reverse(substr(reverse('12347-ebjdone-525-ecgfjf-25236-defdafgdeg'),1,instr(reverse('12347-ebjdone-525-ecgfjf-25236-defdafgdeg'),'-','1'))) from dual
    Object definition might look like:
    reverse(substr(reverse({ObjectName}),1,instr(reverse({ObjectsName}),'-','1')))
    Regards,
    Kuldeep
    Edited by: Kuldeep Chitrakar on Feb 12, 2010 8:12 AM

  • How to find the CONNECTION STRING

    how to find the connection string through SQL Statement?
    salahuddin/salahuddin@CONNECTION_STRING
    Below is all about my sql version:
    DEFINE SQLPLUSRELEASE = "800060000" (CHAR)
    DEFINE _EDITOR         = "Notepad" (CHAR)
    DEFINE OVERSION = "Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
    With the Partitioning, OLAP and Data Mining options" (CHAR)
    DEFINE ORELEASE = "1002000100" (CHAR)

    In windows XP plateform your can find from the ServicesHow can you do that using SQL statement? Plus connect strings are not available in Services. In post 9i SQL*Plus we can do it in SQL statement like this
    SELECT '&&_CONNECT_IDENTIFIER'
    FROM dual;
    Note: This will work only in SQL*Plus.

  • GREP 'find/change' by list script: find a text string containing different para styles

    Hi
    I'm don't write scripts but do 'enjoy' copying, pasting and changing existing code/txt files.
    I have built a GREP find/change .txt that performs a large number of text edits/changes.
    But I'm left with an issue where I have paragraphs of text (styled earlier in the .txt file) that I'm unable to identify using GREP the usual way. I need to identify text in a particular paragraph style, followed by text in another paragraph style.
    Is it possible with GREP to create a search string to find: text styled with one paragraph style, ending with a paragraph return, and to include in that selection the following paragraph/s styled with another paragraph style?
    MTIA Steve

    seb400 napisał(-a):
    What do you mean by I would mark "changing" in "copying, pasting and changing"?
    Hi Steve,
    I mean I can see a way by modifying some existing code with "find...change" job
    1. set criteria to findGrep
    2. store findGrep() in an array
    3. check each found object if next paragraph matches some new criteria
    4. run changeGrep() if true
    Jarek

  • How to find length of string after encryption using DBMS_CRYPTO package

    Hi,
    I am planning do data encryption using DBMS_CRYPTO package. I want to find how much will be string length after encryption.
    e.g When I try to encrypt string of length between 1-15 characters it gives me encrypted string of 32 characters. When I try with 16 charcters encrypted string is of 64 characters.
    Is ther any formula to calculate length of encrypted string?
    Thanks
    Pravin

    The length change is dependent upon the algorithm you are using which can be a combination of cipher block, padding, and chaining.
    The best solution is determine the method you are going to use and apply it to the l ongest possible strings you are going to proces, then add some safety margin. There iis no penalty for defining your column as VARCHAR2(4000).

  • Find and replace string in file

    hi,
    i need to find and replace text (string) data in about 100+ files, i've decided to write a small java program to do it but i'm stuck on how to replace.
    here is what i'm heading towards:
    class ReplaceString {
      BufferedReader in;
      BufferedReader os;
      public static void main(String args[]) {
        ReplaceString obj = new ReplaceString();
        obj.replace();
       void replace() {
         try {
           in = new BufferedReader(new FileReader("a.txt");
           os = new BufferdWriter(new FileWriter("a.txt");
           //  read until end of file
           String currentLine = new String();
           while((currenLine=is.readLine()) != null) {
             //  if matching text then replace????
             if(currentLine.equals("Version 001") {
                // how to now replace the Version 001 with Version 002???
         }catch(IOException e) {
            System.out.println(e);
            in.close();
            os.close();
         in.close();
         os.close();
    }the above code i just typed so there might be errors, but looks ok to me, is there any way once i find the string i want to replace, to replace the string with another string. basically i want to replace all occurrences of the text "Version 001" with "Version 002"
    Thank you.

    Is it always true, as in your example, that the replacement is the same length as the existing string? If so, this one's easy.
    Is it also true that you don't need to worry about 16-bit chars? (Again, as in your example.) If you're using just ASCII characters, this gets easier still.
    1) Segregate the file I/O from the search/replace process.
    2) Main becomes:
    readFile();
    replace( "this", "that" );
    writeFile();Use a byte array buffer, defined in your main class. Fill it via the readFile() code. Use a RandomAccessFile, check its length() to allocate your byte array, then do a single read() to fill the buffer.
    A brute force search will certainly work: scan for the first search character, then check the rest for a match, replace if you've got a match and continue scanning. Alternative if your file's aren't too big: create a String from the byte array:
    // buffer is a byte array
    String s = new String( buffer );And use the String.replaceAll() to do the search/replace. Recover the buffer with:
    buffer = string.getBytes();A single write() and close() should handle the remaining work.

  • How to use String Function Find() in a String Value Test?

    Hi,
    i intend to match a substring of the string returned from my UUT when using a String Value Test - VI call.
    I write the returned string to a Local Variable type String (Locals.data_read) and in the Limits Tab - under Expected String Value am using Find(Locals.data_read, "Connected"). When i Check the expression for Errors - i get a warning "Expected String, found Number {64-bit Floating Point}. this value will cause a run-time error."
    What am i missing?
    Thanks
    Kech
    Solved!
    Go to Solution.

    The Find function evaluates to a number:
    Number Find(String string, String stringToSearchFor, Number indexToSearchFrom = 0, Boolean ignoreCase = False, Boolean searchInReverse = False)
    Returns: The zero-based character index, starting at the beginning of the string, of the first character in the substring.  The function returns -1 if it does not find the substring.
    It looks to me like you need to do a numeric step type.  Not a string value test.
    Or you can do something like this:
    Find(Locals.data_read, "Connected") < 0 ? "Doesn't Matter What Is Here" : Locals.data_read
    Hope this helps,
    jigg
    CTA, CLA
    teststandhelp.com
    ~Will work for kudos and/or BBQ~

Maybe you are looking for

  • Error while opening the receipt entry form in AR module.

    Error while opening the receipt entry form in AR module. We have created one new responsibility of Receivables for new operating unit . When we open the corresponding forms , we are getting the error message as : NO_DATA_FOUND FRM-40735: PRE-FORM tri

  • Custom field in IQ02 in general tab

    Hi, I want to add custom field in tab 'Genera'l in tcode IQ02 . I tried to find the screen exits but none of them is useful. I want to add in program : SAPMIEQ0 Screen number:  101. Is there any way through BADI we can add the same? Kindly provide me

  • New Project Proposal: Model Driven Health Tools

    MDHT supports the specification and implementation of healthcare information models by creating UML profiles, model transformations, publication, code generation, and model editing tools for clinical informatics users. https://projects.eclipse.org/pr

  • Stop Right Clicks from automatically Opening link in new tab?

    So Normally I would right click a link, scroll down to "Open link in new tab" or "Open link in new Window" ect ect. But now, before I can choose which option I want (tab or window) it automatically opens the link up in a new tab. it does it for every

  • Is there a preferred Video Camera in the forum for use with FCE?

    I am on the hunt for a new HD camcorder in the 800 to 1200 US dollar range. Is there a preferred recording format or anything specific to look for that will help my camera work best with FCE or better yet are there things I should try to avoid? I am