Extract all numerical values of > = 10 length

Hi all

I have a table named "STS_HISTORY".
in which I have 2 fields
Number STSID
History varchar2 (4000)

I need to create another table that has 2 fields
stsid, mynum
where stsid is the same from the table of sts_history
and mynum will contain the numerical value of > = length 10.

for example
will he be stsid: 1 the history field is
"123456789 1234567890 here 12345678901 123456789012 1234567890123 data please 12345678901234 seprate 1'
You must then put

1 1234567890
1 12345678901
1 123456789012
1 1234567890123
1 123456789012345

is there way to sm to do using only does not xmltable

of course there are:

SQL> with sts_history as (
 select 1 stsid, '123456789 here 1234567890 is 12345678901 some 123456789012 data 1234567890123 plz 12345678901234 seprate 1' history from dual union all
 select 2 stsid, '123456789 here 1234567890 is 12345678901 some 123456789012 data 1234567890123 plz 12345678901234 seprate 1' history from dual
)
--
--
select stsid, regexp_substr (history, '\w+', 1, level) history
  from sts_history
 where rtrim (regexp_substr (history, '\w+', 1, level), '0123456789') is null
       and length (regexp_substr (history, '\w+', 1, level)) >= 10
connect by     level <= length (history) - length (replace (history, ' '))
           and prior stsid = stsid
           and prior sys_guid () is not null
/
          STSID HISTORY
--------------- ---------------
              1 1234567890
              1 12345678901
              1 123456789012
              1 1234567890123
              1 12345678901234
              2 1234567890
              2 12345678901
              2 123456789012
              2 1234567890123
              2 12345678901234 

10 rows selected.

Tags: Database

Similar Questions

  • need to "extract" a numerical value of the given XML node

    My question: -.
    of a document XML how can I 'extract' a numeric value for use in a "customized math expression" to convert inches into millimetres/centimetres dimensional data?

    FYI: -.
    When you use a component XML Connector that I am able to load and display the values of XML data, of my choice, the XML document required; the data is loaded into the components that are instances of TextArea or TextInput.

    background: -.
    in order to make use of the value of XML data I tried to assign it to an 'intermediate and temporary variable' using the ComponentInstanceName.text option in an assignment, but that effort failed, where this post.

    your comments: -.
    all comments, suggestions, ideas are received with gratitude; Please keep in mind that cindy I am a newb to XML format, but hope that change in the coming months.

    Thanks for your time.

    ... and so, I discovered that the main reason for my bad be able to access the data is due to the fact that the xml data is not fully charged in my application when my code is trying to access. of course it's because of the asynchronous loading of the Flash XML Connector component behavior.

    so the repair to the original message is:-
    check that the data is fully loaded into the app and only then access and assign it to all the other required variables.

    SORTING :)

  • text field with numeric values for sorting

    I'm having a problem my sort. Usually, when the column follows a format, I can use a combination of INSTR and LPAD to sort correctly. In this new case, my columns does not follow a specific format.

    Sample data:
    with t as(
    select 'xxx 10 MG yyy' sortcol from dual union
    select 'xxx 5 MG yyy' from dual union
    select 'xxx 28 MG yyy' from dual union
    select 'aa 10% 12.5 ' from dual union
    select 'aa 6.25% 12.5' from dual union
    select '222 zzz 30/17.5' from dual union
    select '222 zzz 30/5.5' from dual
    )
    select * from t
    
    SORTCOL
    222 zzz 30/17.5
    222 zzz 30/5.5
    aa 10% 12.5 
    aa 6.25% 12.5
    xxx 10 MG yyy
    xxx 28 MG yyy
    xxx 5 MG yyy
    I want to sort the data in the
    222 zzz 30/5.5
    222 zzz 30/17.5
    aa 6.25% 12.5
    aa 10% 12.5 
    xxx 5 MG yyy
    xxx 10 MG yyy
    xxx 28 MG yyy
    I'm trying to replace all numerical values in the string to have 4 digits. For example:

    xxx yyy MG 0010
    xxx yyy MG 0028
    xxx yyy 0005 MG
    0222 zzz 0030/0017.0005
    0222 zzz 0030/0005.0005

    If Oracle will sort correctly digital in the form of text fields. I thought I found the solution with the regular expression:
    select regexp_replace('x10x100x6.5x','([0-9]+)',lpad('\1', 4,0)) from dual
    
    x0010x00100x006.005x
    But the problem is that the backreference in the LPAD overrides the value before it run LPAD. He treats her like the literal string '\1' as oppose to the reference value: 10, 1, 6, and 5. Therefore, LPAD think length is always 2, length ('\1') = 2 instead of length('100') = 3.

    Is there another method to develop all the numbers? Thank you for your time.

    Hello

    You can do with nested REGEXP_REPLACEs:

    SELECT   sortcol
    ,      REGEXP_REPLACE ( REGEXP_REPLACE ( sortcol
                                 , '([0-9]+)'
                              , '000\1'
                              )
                   , '[0-9]+([0-9]{4})'
                   , '\1'
                   )     AS four_digits
    FROM       t
    ORDER BY four_digits
    ;
    

    You probably don't want to display the string converted; you want to just ORDER BY it. It is included in the SELECT clause only if you could see what it was, for the tests.
    Output:

    SORTCOL         FOUR_DIGITS
    --------------- ------------------------------
    222 zzz 30/5.5  0222 zzz 0030/0005.0005
    222 zzz 30/17.5 0222 zzz 0030/0017.0005
    aa 6.25% 12.5   aa 0006.0025% 0012.0005
    aa 10% 12.5     aa 0010% 0012.0005
    xxx 5 MG yyy    xxx 0005 MG yyy
    xxx 10 MG yyy   xxx 0010 MG yyy
    xxx 28 MG yyy   xxx 0028 MG yyy
    

    As you can see, the inner REGEXP_REPLACE adds 3 leading 0 to each number, if she need to 0, 1, 2, or 3. This means that each number will be at least 4 digits, but maybe more. The external REGEXP_REPLACE replaces 4 digits with the last 4 digits only.

    Thanks for posting the sample data in a useful form. The description of the problem was very clear, and it was useful to see that you had already tried and your results on why it does not work. I wish we could mark questions as "Correct." This one was really were.

    Published by: Frank Kulash, January 21, 2011 16:20

  • ORA-20507: invalid numeric value

    Hi all
    I implement this excellent example: http://apex.oracle.com/pls/otn/f?p=48254:2:965943842947140:NO:P2_EMPNO:7369 #.
    I am able to call the PopUp page and create the new value for the element. "My data is also backed up in my form Page, but I get a ' ORA-20507: invalid numeric value ' error message. Once, I check the table that the record has been inserted, but the error message continues to be displayed.
    I saw the Forum and many State of discussions that it is a "to_number" which must be added to the logic in the application process. I tried this and have also tried logic V ("") for the Page element in the process of application, but without success. If anyone knows how to fix this your help is really needed, thanks.

    Hi Charles,

    The example of the 'new town' was based on the assumption that the city would be the value stored on the table rather than a foreign key.

    I've updated your process to get the ID for the new item and pass back to the home page:

    DECLARE
     vCOUNT NUMBER;
     vID NUMBER;
    BEGIN
     IF :G_CLASS_NAME IS NOT NULL THEN
      SELECT COUNT(*) INTO vCOUNT FROM HRT_CLASS_NAME WHERE CLASS_NAME = :G_CLASS_NAME;
      IF vCOUNT = 0 THEN
       INSERT INTO HRT_CLASS_NAME (CLASS_NAME) VALUES (:G_CLASS_NAME);
      END IF;
      SELECT PK_CLASS_NAME_ID INTO vID
       FROM HRT_CLASS_NAME WHERE CLASS_NAME = :G_CLASS_NAME;
      HTP.PRN(vID);
     END IF;
    END;
    

    (Note that I had a lot of problems to actually make a value - the definition of the table displays the fields with a type of NUMBER(*,0) - I think that this should be just NUMBER - you might want to change these, I've updated PK_CLASS_NAME_ID)

    The PTH. PRN (vID) line passes the PK of the folder to the javascript function call that past on it (the "ret" in the code value) return to the homepage and the new classname:

    function saveClassName()
    {
      var classname = document.getElementById('P3_CLASS_NAME').value;
     if (classname == '')
     {
      alert('You must enter in a name');
      return false;
     }
     else
     {
      var get = new htmldb_Get(null,$v('pFlowId'), 'APPLICATION_PROCESS=CREATE_CLASS_NAME',3);
      get.add('G_CLASS_NAME',classname);
      ret = get.get();
      opener.updateClassNameList(ret, classname);
      get = null;
      close();
     }
    }
    

    The function updateClassNameList on the homepage just must then use to create the list, select an option:

    function updateClassNameList(newid, newclassname)
    {
     var classnamelist = document.getElementById('P2_FK_CLASS_NAME_ID');
     appendToSelect(classnamelist, newid, newclassname);
     classnamelist.selectedIndex = classnamelist.options.length - 1;
    }
    

    Andy

  • How to interpret the numerical values of SQL_ColType()?

    Hello

    After the execution of:
    ..
    Call SQL_Connect("abcDB","user","pw","") ' abcDB is an ODBC link to my Mysql 5 database
    Call SQL_ExecDirect ("SELECT id, temperature, tsdat FROM v$ _header WHERE id")< 1000")="">
    ..

    > the SQL_ColType(1..ColumnNo) variable shows me the data types of each column to a numeric value, for example:

    SQL_ColType (1) = 4
    SQL_ColType (2) = - 9
    SQL_ColType (3) = 93

    What real data types are behind the values? It would be nice to get a complete list of all possible values?

    Thank you.

    Hi ddehn,

    The SQL_... orders () are the old method for DIAdem to connect to SQL databases, using the ODBC approach.  Since the tiara 10.2 the ADO approach is the recommended method.  This is the function that I used to use to make sense of the values SQL_ColType():

    Function GetODBColTypes()
    Dim j, jMax, ChTypes
    jMax = SQL_ResultCols
    < 1="" then="" jmax="">
    ReDim ChTypes (jMax)
    FOR j = 1 TO jMax
    IF SQL_ColType (j) = 93 THEN
    ChTypes (j) = "DateTime".
    Else if SQL_ColType = - 1 OR SQL_ColType (j) (j) > 8 THEN ' STRING
    ChTypes (j) = "String".
    ON THE OTHER
    ChTypes (j) = 'number '.
    END IF ' SQL_ColType (j)
    NEXT ' j
    GetODBColTypes = ChTypes
    End Function ' GetODBColTypes()

    Brad Turpin

    Tiara Product Support Engineer

    National Instruments

  • Boolean functions accepts numeric values...

    Recently I got to know that all Boolean functions both accept numeric values. But what is the purpose of it?

    I found the exit of some random values while entering numerical values of Boolean functions...

    Thank you!!

    Best regards

    Adel SR

    srrashme wrote:

    I'm not clear. Can you please attach an example?

    What you don't understand?

    When the Boolean logic is used on integers, the logic is made on a basis by ILO.  I have to do this all the time to encode and decode data from specific protocols (some more wild than the others).  It is also necessary for many data (such as a CRC or Reed Solomon) controls and for encryption (AES, OF THE, 3DES).

  • How can I get the numeric value of a reference?

    I would like to get the numeric value of a reference.  If I look at any reference with a probe, I can see it has value, i.e. F280006B.  I would like to enter this value in a digital indicator for some troubleshooting I do. but running a Ref directly in a digital indicator introduced the code. Somehow the probe's work, it must be accessible. All advice out there?

    Type caster in U32.

    Lynn

  • What happened to 'extract all '?

    I just went to Vista. Although there is a copy of WinZip on my machine, I'm unable to find, much less use the 'extract all' Windows internal. What happened, and how can I get it? James Gotcher

    Thanks, that did it. The salesperson who I bought the computer put on WinZip and I was not able to retrieve the default value of Windows. Your recommendation was perfect and solved the problem.

    Thanks again.

    James Gotcher

  • Numeric value of time zone

    Hi all

    How can I get the numeric value of the current time zone on the device

    ex: GMT = 0.0

    Cairo = + 2.0

    XXX = - 6.0

    coz the API zone get a string representation of the time zone Id, not the digital representation.

    Thank you, all

    . getRawOffset() or

    .getOffset?

  • Want to get the records of only numeric values

    I have tables sales_order, with column ATTRIBUTE_8 VARCHAR2 (50) and job_order with column NUMBER HIGH_AMOUNT.

    attribute_8 column of the sales_order table has both numerical values & character values.  For example:-32232.3764, 234283.878, YES, NOT... etc.

    I intend to load data of tabe sales_order to job_order. For all non-numeric values of ATTRIBUTE_8, I want to do as a 0.

    Please indicate an INSERT statement to achieve this.

    create or replace function clean_number(p_string in varchar2) return number is
    begin
      return to_number(p_string);
    exception when value_error then
      return 0;
    end clean_number;
    /
    with input(ATTRIBUTE_8) as (
      select '-32232.3764' from dual union all
      select '234283.878' from dual union all
      select 'YES' from dual union all
      select 'NO' from dual union all
      select '1e4' from dual
    )
    select attribute_8, clean_number(attribute_8) high_amount from input;
    
    ATTRIBUTE_8 HIGH_AMOUNT
    -32232.3764 -32232.3764
    234283.878 234283.878
    YES 0
    NO. 0
    1E4 10000
  • How to extract all the accounts through REST field

    I'm fighting with the REST API calls, I want to extract all records with all of the fields available in them through REST. That's what I've tried so far:

    $client = new EloquaRequest ($eloqua_site, $eloqua_user, $eloqua_password, 'https://secure.eloqua.com/API/REST/1.0');

    $accounts = $client-> get ('/ data/accounts? search = * & count = 1000 & page = 1 & depth = complete ');

    now when I print $accounts it gives only this result:

    [1] = > stdClass Object

    (

    [type] = > account

    [id] = > 365

    [converted] = > 1372683444

    [depth] = > full

    [description] = >

    [name] = > Verkeer in Waterstaat

    [updatedAt] = > 1372683444

    [Address1] = >

    [address2] = >

    [address3] = >

    [businessPhone] = >

    [City] = >

    [country] = >

    [fieldValues can only be] = > Array

    (

    )

    [PostalCode] = >

    [province] = >

    )

    There are more number of fields available under 'Accounts' that which is visible here. All custom fields not is also not recovered, unknown reason!

    Your help is very appreciated to resolve this matter as soon as possible.

    Using version 2.0 of the rest what API should return all the field values:

    GET /Api/rest/2.0/data/accounts?depth=complete&count=1000

  • Data clean on a numeric value in the text field

    Hello team,

    There is a field called 'turnover' in our Eloqua instance. It is a text field, but contains mostly numeric values synchronized in the same field of SFDC. The SFDC field is numeric.

    I am trying to write a program of standardization of data that uses the "Annual sales" value to update another field, "standardized annual income", with the value appropriate for example Strip $0 to $5 M, $5 - $10 M, $10 / $20 M...

    I created a rule to update that search values:

    • between 1 and 5000000 "turnover" and updates the "standardized annual income" field of $0 à $5 M
    • between 5000001 and 100000 in the "Annual income" and updates the "standardized annual income" field $5-$10 M
    • and so on...

    However when I test it I get the correct value in 'annual standardized income. " I also tried using filters to make contacts with the "annual income" values between 0 and 5000000 but I get all kinds of values outside this range.

    Can someone tell me where I'm wrong? Is it because the data type of the field 'Turnover' is the text rather than digital? I guess I could create a new numeric field for "Annual income", write values existing in this area and change the SFDC integration but I would avoid it if possible. If anyone has any bright ideas, I'd love to hear them.

    Thank you

    James

    For anyone interested, I got the answer from the Support. As it is established as a text field that eloqua is trying to make an alphabetical "between" rather than a digital "between". As it is not possible to change the data type of a field, I need to create a new digital field, export the data to the existing field (as well as email address) and upload again to the new field.

  • Extract only 2nd value

    Hello

    I want to extract only 2nd value of col2 that holds the values of semicolons.

    When I try his failure to appear as expected.

    Table

    col1 col2

    ------    ----------

    A cod; MOD; KL

    B; DF

    C ss; 6; 7

    D gg

    Expected results:

    col1 col2

    ------          ----------

    A mod

    B               df

    C

    D

    My test:

    with

    a trial in

    (select 'A' col1, col2 "cod;) MOD; KL' Union double all the

    Select 'B ', '; '. df"of the double

    Union of all the

    Select 'C', "ss; 6; 7' of the double

    Union of all the

    Select would be ', 'gg' of the double

    )

    Select col1,

    NULLIF (regexp_substr (NVL(col2,'~'), "[^;]")) +', 1, 1),'~ ') col2

    of the test;

    I get:

    col1 col2

    ------          ----------

    A mod

    B               df

    C               ss

    D               gg

    Any help will be appreciated.

    Thank you

    Hello

    You can also use regular expressions to get the N-th section, like this

    REGEXP_SUBSTR (col2

    , '([^;] *)(;|$)'

    1

    N - whole, to 1 or greater

    NULL

    1

    )

    SUBSTR and INSTR will be faster, however.

  • Find the maximum numeric value to a String

    Hi all

    I want to find the maximum number of the string using PLSQL. How can I do this simply.

    Example string: "D32X1U7".

    And I want to get maximum numeric value is of this string. (7)

    Thank you

    Something like this:

    SQL >

    SQL > with input_data (select ' D32X1U7' double Str).

    2 split_char AS (select substr (str, level 1) c

    input_data 3

    4. connect by level<=>

    5                     )

    6 select max (c)

    7 of split_char

    8 where the regexp_like (c, ' [[: digit :]]');]])

    MAX (C)

    ------

    7

    SQL >

  • REGEXP_REPLACE - Exclude ONLY zeros if there is between a character and numeric value [1-9]

    Hi all

    I need your help in providing me the regular expression to exclude zeros only if it sits between the characters and a nonzero numerical value.

    For example:

    PL032 = > PL32

    GDP500 = > GDP500 (should remain is that the zeros are not between a character and not null)

    SOA008 = > SOA8

    GDP000 = > GDP0 (only exception: If that's all the 000 and then convert it 0)

    Thank you for your help in advance.

    Kind regards

    Emeline

    Hi, emeline,

    1000877 wrote:

    Hi all

    I need your help in providing me the regular expression to exclude zeros only if it sits between the characters and a nonzero numerical value.

    For example:

    -ONLINE PL32 PL032

    GDP500-online GDP500 (expected to remain is that the zeros are not between a character and not null)

    SOA008-ONLINE SOA8

    GDP000 => GDP0 (only exception: If that's all the 000 and then convert it 0)

    Are characters.  When you say "between characters and numeric value", do you mean "between non-numeric characters and numeric characters?

    If so:

    REGEXP_REPLACE (str,

    '(\D)0+(\d)'

    , « \1\2 »

    )

    \D (with a capital D) means any non-digit character.

    \d (with a small d) means any numeric characters, including 0.  Because regular expressions are greedy by default, "0 + 'match all ' 0' if some other number follows, but leave the last '0' (as you want) then there is not another number immediately after him."

Maybe you are looking for

  • iTunes download stuck, don't restart, won't erase

    I have about 35 song downloads that I did not, stuck in my iTunes on my iPad Pro.  All of them say "download error. Tap to retry"when I tap the blue arrow to download (to relaunch) nothing happens.  When I drag to remove, no red delete option reads,

  • Using Lenovo C540 all-in-one as a second screen

    I recently bought two computers, a laptop Asus desktop Lenovo C540 all-in-One touchscreen, Windows 8 and Windows touch, 8. The issue I'm facing is to attempt to use the Lenovo as the 2nd screen to the laptop. Is this possible with an all-in-one devic

  • DeskJet 3420: deskjet 3420 other driver installed, but the printer is still not printing

    Hello everyone, I followed the instructions under the "alternative install print driver for Win 7 for USB. Once the Windows Update over the 3600 was not present, but the 9800 has been (I've read is also a generic driver). I can see the printer in my

  • Rename the first alias

    Rename my primary alias attempts fail. Here is the response I get when using your tool:"You cannot use your secondary e-mail as Microsoft account. Please enter another Microsoft account. » I even earlier, tried to add and then remove the e-mail (* ad

  • virus boot.tidserv.b

    Dell optiplex gsx620 boots to load then goes black dosnt do anything, cd player works ran resourse cd that came with it checked that everything ok that no error has run the norton bootable recovery tool found virus Boot.tiserv.b could not repair.will