Extracting a  a piece of string starting with a number

Hi,
I am new to SQL, so I could use some help with the following issue. I need to extract contract number from a string, but the position of the contract number and the text inside of the string might vary, which means it is important to tie the SELECT statement to the number. Extracting only numbers wouldn't help too, because contract number contains letters and other characters. For example, if there was a string "Payment to a contract nr 1100/70HE", the SELECT statement should be able to extract only "1100/70HE" from that string.
Thank you in advance,
Keit

Hi,
welcome to the forum.
Please read SQL and PL/SQL FAQ
When you put some code or output please enclose it between two lines starting with {noformat}{noformat}
i.e.:
{noformat}{noformat}
SELECT ...
{noformat}{noformat}
Coming to your question, I would say that extracting the contract number from a string it is not the ideal solution for a data model.
Beside that, you may be able to reach your goal by using regular expression but you should provide more example and explain if the contract number could be identified with a specific pattern.
I suggest you to post some sample data (CREATE TABLE and INSERT statement or a WITH statement) and try to identify a rule that can apply to extract your data.
I.e.: if contract number always is one or more characters, followed by a slash (/) and followed by one or more characters then maybe you can use regular expression to identify it. I suggest you to post some cases and try to find the logic to apply.
Regards.
Al                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

Similar Messages

  • How to test if String starts with a Range of numbers

    Hello,
    I'm reading in a line from a text file and I want to see if that line starts with numbers.
    I know there is
    String temp = file.readline();
    if (String temp.startsWith(?1-9?); // want to check if string starts with 1 thru 9
    Thanks!

    Try the following:
    String temp = file.readline();
    if (temp.equals("1") || temp.equals("2")....... || temp.equals("9") {
    System.out.println("String is beetween 1 - 9");
    else{
    System.out.println("String is not beetween 1 - 9");
    Replace the "....." by the other values... I know it's quite long, but it should work... must be an easier way though...
    Pierre

  • Regular expression matches string starts with &

    Hello,
    I am trying to write a Reg Exp that removes any string starts with "&" and Ends with ";" . In other words, I am trying to remove anything similar to:
    & nbsp;  & quot; & lt; & gt;  Any help please.
    This does not work:
    select regexp_replace(ename, '^&[a-z]{2,4}[;]$') from emp;Regards,
    Fateh

    Fateh wrote:
    I am trying to write a Reg Exp that removes any string starts with "&" and Ends with ";" . In other words, I am trying to remove anything similar to:
    & nbsp;  & quot; & lt; & gt; 
    Those are entity references (without the whitespace after '&').
    Do you really want to remove them, or do you actually want to convert them back to their corresponding characters but don't know how to do it?
    SQL> set scan off
    SQL> select utl_i18n.unescape_reference('"Test": 3>2') from dual;
    UTL_I18N.UNESCAPE_REFERENCE('&
    "Test": 3>2

  • String "starts with" function in ABAP

    Hi!
    I need to check in ABAP, if a given profit center (char 10) starts with P172. It could be filled with zeros -> 0000P17255. So I need to perform 2 actions:
    1)
    Lefttrim the 0 -> Result: P17255.
    2)
    Check, if the string starts with P172.
    How can I do this in ABAP?
    Thanks,
    Konrad

    Hi,
    You can do as below :
    1st scenario :
    loop at itab.
    "Below code will delete leading zero.
    SHIFT itab-prctr LEFT DELETING LEADING '0'.
    "Second scenario
    if itab-prctr(4) = 'P1972'.
    "Do necessary coding as per your requirment.
    endif.
    "If you wnat chnage tje contensts of the itab you can use modify else you append to append to another internal table.
    endloop.
    Thanks,
    Sriram POnna

  • How to access a JSON structure key that starts with a number

    I've got an odd issue here.  I'm accessing someone else's JSON structure so I am not able to change it.  The JSON structure keys are named with both characters and numbers like this:
    0
    198456
    product_id
    198456
    1
    Rashaan Houston feat Tony Loreto
    artist
    Rashaan Houston feat Tony Loreto
    So, in other words, there's a key named "0" and a key named "product_id", both of which contain the same key.  Why they did that, I don't know, but they did.
    In one of the instances, the data stored under the text-named key isn't the same as the numerical-named key.  I tried to output the data in the numerical key like this (it's an array of structures):
    #strStompyJSON.data[1].0#
    but I get the following error:
    Invalid CFML construct found on line 41 at column 31.
    ColdFusion was looking at the following text:
    .0
    When I do the following, it works fine:
    #strStompyJSON.data[1].product_id#
    So it looks as though CF doesn't like accessing a variable that starts with a number.  I am able to loop through the structure using a collection loop, and it outputs all of the keys (including the numerical ones) and their values using the following code:
    <cfloop collection="#strStompyJSON.data[1]#" item="key">
    #key#: #strStompyJSON.data[1][key]#<br />
    </cfloop>
    However, that doesn't allow me a way to access specific keys named with a number.  Is there a way that I can specifically access a key that is named with a number?
    thanks!
    Mike

    No problem--glad it worked out.
    As a follow-up to this, I'd encourage you to keep the bracket notation in mind during future development.  It is EXTREMELY useful in a lot of situations.
    For example, if you're building a structure on the fly with dynamic keys, bracket notation is extremely helpful:
         <cfset authors = structnew()>
         <cfloop list="authorlist" index="name">
              <cfset authors[name] = getbooklist(name)>
         </cfloop>
    Also, bracket notation is really nice when creating json from ColdFusion structures.  Consider this:
         <cfset author = structnew()>
         <cfset author.name = "Neil Gaiman">
         <cfset author.genre = "Fantasy">
         <cfset author.awesome = true>
         <cfset authorjson = serializejson(author)>
    By default, the serialized json produced will have all UPPER CASE keys.  Not a big deal in most cases, but if you're returning the json to something (like a JS library) that is expecting keys in a certain case, it can be a problem.  Fortunately, bracket notation allows you to specify exactly what case you want the structure's keys to be in:
         <cfset author = structnew()>
         <cfset author['name'] = "Neil Gaiman">
         <cfset author['Genre'] = "Fantasy">
         <cfset author['AWESOME'] = true>
         <cfset authorjson = serializejson(author)>

  • "User names cannot start with a number" error while adding a user

    Is it possible to use WL Portal 7.0 admin framework to manage users with all numeric
    user id ?
    I got an error "User names cannot start with a number" while trying to add users
    with all numeric user ids. I am using "portalAppTools" web app provided with WL
    7.0 out of the box.
    What "out the box" functionality do I need to change to make this happen ? Thanks
    Shah

    The problem is that when we have user groups starting with a number, then the search
    feature doesn't work for user groups (case # 466837 with BEA).
    So, which brings me to the following question:
    a. Should the search feature work?
    b. What is the limitation? I mean, it is designed not to allow user groups starting
    with a number. So, there must be a reason for this. So, if we change "disallowFirstCharDigit",
    will it have any impacts on Portal?
    As an aside, it seems somewhat strange that the Portals can start with a number!
    Thanks in advance
    Venkatesh
    "Ture Hoefner" <replyto@newsgroup> wrote:
    Hello Shah,
    Search your tools web app for the UsermgmtTools.properties file. In
    my
    installation, it is at:
    D:\bea70sp1\weblogic700\samples\portal\sampleportalDomain\beaApps\sampleport
    al\tools\WEB-INF\classes\com\bea\jsptools\p13n\usermgmt\servlets\jsp
    It starts with this:
    # Messages and other properties used by usermgmt jsp tools
    # Name properties - UserBean and GroupBean
    disallowedCharacters: ~`!$%^&-*() {}[]|\\/?<>,:;+="'
    disallowFirstCharDigit: true
    Ture Hoefner
    BEA Systems, Inc.
    www.bea.com
    "Shah Sidi" <[email protected]> wrote in message
    news:3db0a001$[email protected]..
    Is it possible to use WL Portal 7.0 admin framework to manage userswith
    all numeric
    user id ?
    I got an error "User names cannot start with a number" while tryingto add
    users
    with all numeric user ids. I am using "portalAppTools" web app providedwith WL
    7.0 out of the box.
    What "out the box" functionality do I need to change to make this happen?
    Thanks
    Shah

  • "HTTPS hostname wrong" for a hostname starts with a number

    Does anyone know about why HttpsClient throws the error for a hostname starts with a number. I have no problem with other hostname but only for the hostname starts with a number. The certificate works fine with Browser. I am sure the hostname in the certificate and in the request are exactly the same.
    I know how to skip the hostname verification, but I don't want to do that for security concern.
    Can sun develpoer shed some light how to verify the hostname in HttpsClient?
    java.io.IOException: HTTPS hostname wrong: should be
    <1company.mydomain.com>
    at sun.net.www.protocol.https.HttpsClient.b(DashoA6275)
    at sun.net.www.protocol.https.HttpsClient.afterConnect(DashoA6275)
    at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(DashoA6275)
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:574)
    at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(DashoA6275)
    at java.net.URL.openStream(URL.java:960)
    Thanks
    Al8079

    I looked at the RFCs you mention, and they do seem to indicate that host/domain names cannot start with digits...however if you look at RFC 1123 closely it says:
    RFC1123 APPLICATIONS LAYER -- GENERAL October 1989
    2. GENERAL ISSUES
    This section contains general requirements that may be applicable to
    all application-layer protocols.
    2.1 Host Names and Numbers
    The syntax of a legal Internet host name was specified in RFC-952
    [DNS:4]. One aspect of host name syntax is hereby changed: the
    restriction on the first character is relaxed to allow either a
    letter or a digit. Host software MUST support this more liberal
    syntax.
    Host software MUST handle host names of up to 63 characters and
    SHOULD handle host names of up to 255 characters.

  • Column name in the database starts with a number!

    Hello,
    Recently we updated out database and we changed our tables' and columns' names, I'm developing an adf application with EJB3.0 the question is that the new column names start with a number (eg. 001U_ID), its a kind of encoding the names of the tables so no one can modify the values.
    When I create a query on the table it is throwing an exception:
    Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: Incorrect syntax near 'U_ID'.
    I think the problem is that the EJB3.0 doesn't recognize column names starting with a number!!! What can I do to solve this issue?
    Thanks
    Shahe

    Shahe wrote:
    the entities are declared using the database tables, I'm using EJBQL to retrieve data from the tables.Can you explain this more. Are you using JPA entities? If so post the definition of the Entity bean and the query you used.

  • When I quit itunes it restarts again with the dot under the itunes logo but the iTunes window doesn't open until I click the icon on the dock.  Also in the middle of the size vale in the size column the value starts with a number then a ? then a number.

    When I quit itunes it restarts again with the dot under the itunes logo but the iTunes window doesn't open until I click the icon on the dock.  Also in the middle of the size vale in the size column the value starts with a number then a ? then a number.

    This forum is for questions from those managing sites on iTunes U, Apple's service for colleges and universities to post educational material in the iTunes Store. You'll be most likely to get help with this issue if you ask in the general iTunes for Mac forums.
    Regards.

  • Can't open files where the name starts with a number

    On our network server, we have some folders where the files are numbered. Example:
    1 - Memo
    2 - Agenda
    3 - Report X
    4 - Report Y
    5 - Report Z
    We have 5 Macs in our office. Everybody can read these files fine except for one person. On her computer she can't open any file that starts with a number and gets the below error message. How do I fix this?
    All our Macs (to the best of my knowledge) are setup exactly the same since they were purchased at the same time late last year.

    Word - Microsoft Support

  • How do I number pages consecutively starting with a number other than 1?

    In Pages, how do I number pages consecutively starting with a number other than 1?

    Inspector > Document > Section > Page Numbering:     click on the dropdown menu

  • Oracle Text does not return results when String starts with two consecutive vowels

    Hi,
    I hope someone can shed some light on a strange problem we're facing.
    Oracle Database 11g R2 (11.2.0.4) EE 64-bit running on Windows 2008 Server R2.
    When I create a context index on a varchar2 column (surname) it works fine when the surname starts with either a consonant or one vowel. But when the surname starts with two vowels it fails to return the record?
    Please see worked example below:
    create table t1 (surname varchar2(50));
    insert into t1 values ('OURS');
    insert into t1 values ('JOURS');
    insert into t1 values ('ONES');
    commit;
    -- sync every 10 mins
    CREATE INDEX PERSON_SURNAME_IDX ON t1
    (SURNAME)
    INDEXTYPE IS CTXSYS.CONTEXT
    PARAMETERS('MEMORY 50M sync (every "SYSDATE+10/1440")')
    NOPARALLEL;
    -- no rows
    SELECT surname
    FROM t1
    WHERE CONTAINS(surname, 'OURS') > 0;
    -- 1 row
    SELECT surname
    FROM t1
    WHERE CONTAINS(surname, 'JOURS') > 0;
    -- 1 row
    SELECT surname
    FROM t1
    WHERE CONTAINS(surname, 'ONES') > 0;
    Any help or guidance greatly appreciated.
    Thanks,

    Wtf?
    https://docs.oracle.com/database/121/CCREF/astopsup.htm#i634475
    only     then     where
    all     do     into     onto     there     whether
    almost     does     is     or     therefore     which
    also     either     it     our     these     while
    although     for     its     ours
    select
    from v$version
    Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production    0
    PL/SQL Release 12.1.0.2.0 - Production
    CORE 12.1.0.2.0 Production
    TNS for Linux: Version 12.1.0.2.0 - Production
    NLSRTL Version 12.1.0.2.0 - Production
    SELECT spw_stoplist, spw_word FROM ctx_stopwords
    WHERE spw_stoplist ='DEFAULT_STOPLIST'
    order by nlssort(spw_word, 'NLS_SORT=LATIN')
    ---- snip ----
    DEFAULT_STOPLIST    not
    DEFAULT_STOPLIST    of
    DEFAULT_STOPLIST    on
    DEFAULT_STOPLIST    one
    DEFAULT_STOPLIST    only
    DEFAULT_STOPLIST    or
    DEFAULT_STOPLIST    other
    DEFAULT_STOPLIST    out
    DEFAULT_STOPLIST    over
    DEFAULT_STOPLIST    s
    ---- snip ----

  • SPC Chart and Tag Name starting with a Number

    On a 11.5.3 (latest build) install, we've found that SPC Charts don't like tag names that start with numeric characters.  The data points just don't plot.  I can right click and get the data, but there are no points on the chart.  All other applets work fine with the same tags.  Has anyone else seen this?

    Hey Rick,
    We did try that and it worked.  Also when creating the tags in the UDS Admin, I don't believe the UDS Admin will allow for this scenario (along with funky characters like pipes "|").  However, we are using an alias file (export from Historian into Excel, into SQL, and tweaked via Xacute) where the UDS Admin rules aren't enforced, which might be the inherent problem here. 
    I just thought that if the applets allowed it, the iSPCChart should also. 
    Thanks.
    Edited by: Ryan Miller on Feb 19, 2008 10:04 AM
    I'll leave this thread unanswered for a bit to see if anyone else cares to comment.

  • My Tags that started with a number are gone! I've tagged links with the tag: "3D". they are not in my tags!

    I have tagged quite a few links with "3D" : examples of pages that used 3D in their webdesign, interesting 3D software,3D tutorials... They are all gone!
    I have found, for example, the tag "+eclectic" . So extra characters ARE used in tagging.But nothing that has been tagged with a number is in my bookmarks :-(
    Maybe Mozilla should warn users not to tag using a number?
    Thanks a lot for any help!

    As best as I can tell, 20ms is around the "sweet spot". I've tried it at 10ms and almost immediately started getting faults. At 20ms it's a bit intermittent- sometimes it'll run fine for several minutes and then get a fault, sometimes not. I've tried running at 30ms as well but it's hard to prove a fault would *never* happen.
    Part of my problem is that I don't understand what all needs to happen during this timeframe. Is this an internal loop that's running too slowly, or is my Axis interface code running too slow? Would having too many front panel controls/indicators slow down FPGA access? Should I be using some type of buffer to send configuration data, and keep front panel controls to a minimum?
    I understand that front panel controls can use up memory in an FPGA, but I've got enough space, so I assumed that would be OK, but I'm certainly not sure about any of this as it's all quite new to me.
    I did go ahead and start a service request, but I noticed it was possibly a 2-day turnaround. I'm hoping someone can give me a hand on the forums as that's both quicker and more easily accessible for future users with similar problems.
    Edit: I just did a run at 30 ms, and got the fault about 6 minutes into the run. I've got the RT VI running with the front panel on my computer, along with the Distributed System Manager, and am working on other things while it runs. Not sure how repeatable this will be but take it as it is.

  • Sequence starting with specific number

    Hi,
    Is it not possible to create a sequence in ODI starting with a specific number. An example is such as a sequence starting from 10,000 and incrementing by 1.
    The reason I am asking is because , in the ODI sequence tab, although there is an option for specifying increment factor, there is no place to mention the first element
    of the sequence.
    Kindly suggest.

    Hi,
    Its not recommend to use ODI sequence as it needs to follow some process for implementation, its advisable to use DB sequence for surrogate columns.
    So please use DB sequence and call it in ODI mapping using the below syntax,
    <SCHEMA_NAME>.<SEQUENCE_NAME>.NEXTVAL
    FYR: http://odiexperts.com/odi-sequence
    Thanks,
    Guru

Maybe you are looking for