the index of the first/last numerical value

Hello

I want to find the index of the first numeric value in a string. I can do this by using built-in features of Oracle? (Without creating a new function)

I want to find the index of the first numeric value in a string

regexp_instr could do (for the first digit):

SQL> select regexp_instr('abc1def2', '\d') first_digit from dual
/
FIRST_DIGIT
-----------
          4
1 row selected.

Tags: Database

Similar Questions

  • Select the records from the first n distinct values of column

    I need to write a query in plsql to select records for the first 3 values distinct from a single column (example below, ID) and all lines for the next 3 distinct values of column and so on until the end of the number of distinct values in a column.
    for example:
    Age of name ID
    1 abc 10
    1 def 20
    2 IA 10
    2 20 JKL
    2 mno 60
    3 10 pqr
    4 the RST 10
    4 10 TÜV
    5 vwx 10
    6 10 XYZ
    hij 6 10
    7 lmn 10
    .
    .
    .
    so now... (up to a few County)
    Result must be
    1 the application should result->
    Age of name ID
    1 abc 10
    1 def 20
    2 IA 10
    2 20 JKL
    2 mno 60
    3 10 pqr

    Query 2 should lead to->
    4 the RST 10
    4 10 TÜV
    5 vwx 10
    6 10 XYZ
    hij 6 10

    Query 3 should lead to->
    7 lmn 10
    .
    .
    9... ..
    so now...
    How to write a query for this inside a loop.

    Hello

    Thus, a panel will consist of the lowest id value, the 2nd lowest and the 3rd lower, reggardless of how many lines is involved. The next group will include the 4th lowest id, the 5th lowest and the 6th lowest. To do that, you must assign the numbers 1, 2, 3, 4, 5, 6,... for the rows in order by id, with all lines with the same id, getting the same number and without jumping all the numbers.
    This sounds like a job for the analytical DENSE_RANK function:

    WITH     got_grp_id     AS
    (
         SELECT     id, name, age
         ,     CEIL ( DENSE_RANK () OVER (ORDER BY id)
                   / 3
                   )          AS grp_id
         FROM     table_x
    )
    SELECT     id, name, age
    FROM     got_grp_id
    WHERE     id     = 1     -- or whatever number you want
    ;
    

    If you would care to post CREATE TABLE and INSERT statements for your sample data, then I could test it.
    See the FAQ forum {message identifier: = 9360002}

  • Return to the right of the first white space values

    Hello
    I use Toad for Oracle 10.5 and cannot figure out how to return only the values after the white space for apple to field. I tried to trim, rtrim, ltrim leads; etc... I create table and some inserts to test if possible. Thanks for reading this thread.
    select trim(leading '' from apple)
    FROM tbl_test 
    Create Table
    CREATE OR REPLACE FORCE TABLE TEST
    (
       APPLE  VARCHAR(20),
       ORANGE VARCHAR(20)
      
    )
    Inserts
    INSERT INTO TBL_TEST 
    (APPLE, ORANGE)
    VALUES
    ('123 TEST3', 'TEST');
    
    INSERT INTO TBL_TEST 
    (APPLE, ORANGE)
    VALUES
    ('4567 TEST2', 'TEST');
    
    INSERT INTO TBL_TEST 
    (APPLE, ORANGE)
    VALUES
    ('1 TEST3', 'TEST');
    
    INSERT INTO TBL_TEST 
    (APPLE, ORANGE)
    VALUES
    ('12 TEST4', 'TEST');
    Not:
    select apple from tbl_test
    
    APPLE
    123 TEST3
    4567 TEST2
    1 TEST3
    12 TEST4
    The results that I want:
    select * from tbl_test
    APPLE
    TEST3
    TEST2
    TEST3
    TEST4
    select SUBSTR(apple, INSTR(apple, ' ')+1) from tbl_test;
    

    Output:

    TEST3
    TEST2
    TEST3
    TEST4
    
  • InDesign - prevent breaks between the first and last names in a very long list of names?

    Is there a quick way to do?  Having the list 800 names in a text box and want to prevent the first & last names being split at the end of the line.  Other than choosing each name and apply the rule "no break" (a lot of time).  Any other suggestions?

    This is a more elegant solution:

    (?<=[\l\u]) (?="">

    Apply style: no pause

    It detects all single space between two letters

  • Capitalize the first letter of a sentence in a Textfield

    What is the best way to get a Textfield to behave like those for the first/last name in the addressbook?

    What I want is a field which:

    Capitalizes the first letter in uppercase

    Capitalizes the first letter in uppercase after each point or the dot & space

    allows the user to change it manually again.

    It seems so easy, but in fact is not. I thought about creating some statemachine for her, but it is much more complicated than it seems.

    The javax.microedition.lcdui.TextField has the INITIAL_CAPS_SENTENCE filter, but using this field isn't really an option, because it does not inherit from the RIM material and cannot be added to the managers (or anything else in my code also)

    help please

    Use ActiveAutoTextEditField.

  • Price from the abo student after the first year

    Hey there,

    because I'm a student, I have to pay the first year € 19.34 (at this time), when I choose the student-OBA. But I don't know what is happening with the payment after this first year.

    On this site I discovered, I would pay € 29,74 because it's the 'normal price-abo", but where can I find more information on this"abo-regular price?

    Geschaftsbedingungen | Adobe

    And how many years can I pay the €29,74? I would pay € 29,74 even if I don't have a student more? Why I can not choose the abo-regular price plus € 29,74 directly?

    Kind regards

    Tobias

    When you purchase a subscription to education, the terms you "click to accept" should be clear about the first/last years

    -Intro price http://forums.adobe.com/thread/1448933?tstart=0 one can help

  • Skillbuilders Super LOV, refresh the list of SLOV values dynamically

    Hi, another question.

    I have 2 SLOVs. 1 is a relative of the 2nd.

    The first has its value dynamically for a reason any.
    I can not then dynamically change the value of the 2nd until the cascading effect is triggered by the opening of the 2nd SLOV via the button.

    If the page has LOV1 with value 'A' with LOV2 have child values "A1", "A2", "A3" available and I then proceed as follows

    $('#P1_LOV1).apex_super_lov ('setValuesByReturn', 'B'); (where B is a valid value)

    followed by
    $('#P1_LOV2').apex_super_lov ('setValuesByReturn', 'B1'); (assuming that B1, B2 and B3 are values of child for B)

    Then, it does not work.

    In fact
    $('#P1_LOV2').apex_super_lov ('setValuesByReturn', 'A1');
    $('#P1_LOV2').apex_super_lov ('setValuesByReturn', 'A2');
    $('#P1_LOV2').apex_super_lov ('setValuesByReturn', 'A3'); Still work, even if the parent is now wrong.

    So, basically, it seems that dynamically change the SLOV parent value is not triggering of the ripple effect that manually the SLOV itself chosen.

    Is it possible to force the list of values for updated after change dynamically children parent cascading?

    Concerning
    Mark

    Hi Mark,

    Some problems with the State of session here! Your lov EMP is limited to documents that match the DEPT value in session state. Initially this will be null and no value. Suppose you select a Department and send the page, so that the values are stored in session state. When you open the lov, employees would be only those for the Department which the value is stored in session state. Understand the State of Session, Oracle docs

    You were on the right track with cascading lists, but it breaks your choice by default features. So I've ignored this output, I don't want the default functionality. We need to do our own for this. Don't worry, not too!

    Off, when dept in the default settings or dept lovs changes because of a choice, the selected Department must first go to session state. This is necessary for the lov emp can find the correct records. So I added a dynamic action to fire on the change of P14_CHOOSE_DEFAULTS and P14_DEPT. The real action is a PLSQL code execution. PLSQL is always on the server side, and we can provide items to submit to the session state. The executed code is simply

    NULL;
    

    because we don't need to run anything, but P14_DEPT has the value that will be submitted to the session state when the call is made.

    With these changes, everything works. But EMP must be blanked when DEPT changes. Otherwise, you could spend DEPT autour but are not yet in a bad EMP.
    So I added another dynamic action that fires on the evolution of the DEPT and blanks in the EMP. No worries about default values, picking, because that won't change due to values only being edited
    javascript change events that are not performed.

    PS: don't forget to assign the answer useful/correct labels to messages that are :-)

  • How better to insert a subarray (line) in a 2D array to the correct index which is based on the value of the first column

    Hello

    I would like to insert a subarray (line) in a 2D to the correct index table. The position is to say the index value depends on the value of the first column of the table 2d.

    As an examlple my 2d array would look like this

    230 50 215 255

    300 60 270 330

    360 20 350 370

    And I would like to insert another line (subarray) with the following values

    320 40 300 340

    This new line should be placed between the second and third rows (this is based on the first column only).

    I tried the threshold 1 d function table by taking an 1Dsub array of my 2d array (first column), then using the first of the new line (320) as the threshold. It sort of work, but it does not work when I start the table (IE there is only 1 row) and it seems to not work properly on other occasions (as explained in the help of Labview).

    Hopefully the explanation is clear enough for any suggestion. Thanks in advance for the help!

    JTRI wrote:

    The idea is I have start with a new table and add these lines in the right order every time that the user sets the values Jack

    Ahh, so try this.

    This will also work with an empty array.

    You want to do with this function it is a Subvi.

    Make the entries 'table' and 'subarray"on the connector, then 'new array' output.

    You can then put this Subvi in a loop with a registry to shift and it will help to add new lines in a sorted order, when they are added.

    That is what you were aiming for?

  • values based on the following logic 'values after the first values of two '_' and before last '_' values '.

    Hi all

    I need the values according to below 2logics in a single select query using instring and substring

    1 values based on the following logic 'values after the first values of two '_' and before last '_' values '.

    2 values based on the following logic 'values after the first values of two '_' and before last'-'values '.

    EXM:

    Entry: ABCD_EFGH_IJKLM - NOPQ_XYZ output: IJKLM - NOPQ

    Entry:. ABCD_EFGH_IJKLM - NOPQ output:IJKLM

    Thank you.

    Check the following

    WITH DATA1 AS

    (SELECT "ABCD_EFGH_IJKLM - NOPQ_XYZ" double val)

    UNION ALL

    SELECT 'ABCD_EFGH_IJKLM - NOPQ' double val

    )

    SELECT SUBSTR (VAL, INSTR(VAL,'_',1,2) + 1, DECODE (BIGGER (INSTR (VAL, '_',-1, 1), INSTR(VAL,'-',-1,1)), INSTR (VAL,'-', - 1, 1), LENGTH (VAL) + 1, INSTR (VAL, '_',-1, 1))-(INSTR (VAL, '_', 1, 2) + 1))

    OF DATA1;

    Concerning

    Salim

  • Automatic indexing does not as soon as the first element of the array.

    Hello

    I have a state machine that uses automatic indexing in most of his State to write the registry to set the part for some test.  When the state machine reaches the section 'Now playing' (the fourth State, second battery sequence) I have a picture of two equal elements related to looping for to write the required registers for this specific test.  When I enter the current state read the the first address is the second element of the array which is '1' location and not the first address that must be '0 '.  I closed the program and restarted LabVIEW but I always get the second element in this loop that maintain the form part works correctly and I get an error because the first element turns on the chip.  Is there something I'm not see when it comes to self that he would keep from starting at the first element of indexing?  Please take a look and let me know what I can do wrong.  I have attached the main program and the print loop results screens and test probe.  Any help will be great.  It worked last week.

    I don't see no problem at all when I copy the loop in an another VI in order to run it. Your jpg shows nothing on the values of the probe.

  • Why last extraction lasts much longer than the first three?

    I have this trace file:
    EXEC #3:c=0,e=4803,p=0,cr=0,cu=0,mis=0,r=0,dep=0,og=1,plh=2726503091,tim=2779072194357
    WAIT #3: nam='SQL*Net message to client' ela= 1 driver id=1650815232 #bytes=1 p3=0 obj#=-1 tim=2845769927079
    FETCH #3:c=0,e=2969,p=0,cr=56,cu=0,mis=0,r=1,dep=0,og=1,plh=2726503091,tim=2779072197438
    WAIT #3: nam='SQL*Net message from client' ela= 1006 driver id=1650815232 #bytes=1 p3=0 obj#=-1 tim=2845769931224
    WAIT #3: nam='SQL*Net message to client' ela= 1 driver id=1650815232 #bytes=1 p3=0 obj#=-1 tim=2845769931269
    FETCH #3:c=0,e=322,p=0,cr=2,cu=0,mis=0,r=15,dep=0,og=1,plh=2726503091,tim=2779072198806
    WAIT #3: nam='SQL*Net message from client' ela= 3733 driver id=1650815232 #bytes=1 p3=0 obj#=-1 tim=2845769935348
    WAIT #3: nam='SQL*Net message to client' ela= 0 driver id=1650815232 #bytes=1 p3=0 obj#=-1 tim=2845769935423
    FETCH #3:c=0,e=178,p=0,cr=2,cu=0,mis=0,r=15,dep=0,og=1,plh=2726503091,tim=2779072202692
    WAIT #3: nam='SQL*Net message from client' ela= 3136 driver id=1650815232 #bytes=1 p3=0 obj#=-1 tim=2845769938725
    WAIT #3: nam='SQL*Net message to client' ela= 1 driver id=1650815232 #bytes=1 p3=0 obj#=-1 tim=2845769938763
    FETCH #3:c=410000,e=403256,p=0,cr=7354,cu=0,mis=0,r=13,dep=0,og=1,plh=2726503091,tim=2779072609065
    STAT #3 id=1 cnt=44 pid=0 pos=1 obj=0 op='PARTITION RANGE SINGLE PARTITION: KEY KEY (cr=7414 pr=0 pw=0 time=0 us cost=7 size=9823 card=47)'
    STAT #3 id=2 cnt=44 pid=1 pos=1 obj=0 op='PARTITION RANGE SINGLE PARTITION:   (cr=7414 pr=0 pw=0 time=0 us cost=7 size=9823 card=47)'
    STAT #3 id=3 cnt=44 pid=2 pos=1 obj=590979 op='TABLE ACCESS BY LOCAL INDEX ROWID BA_PGM_SLS_DTL PARTITION: KEY KEY (cr=7414 pr=0 pw=0 time=0 us cost=7 size=9823 card=47)'
    STAT #3 id=4 cnt=44 pid=3 pos=1 obj=590982 op='INDEX RANGE SCAN BA_PGM_SLS_DTL_PK PARTITION: KEY KEY (cr=7408 pr=0 pw=0 time=10 us cost=6 size=0 card=1)'
    WAIT #3: nam='SQL*Net message from client' ela= 3104 driver id=1650815232 #bytes=1 p3=0 obj#=-1 tim=2845770355048
    It seems to me that the first three extractions return 31 lines in very little time, but the last extraction takes environ.4 seconds and about 7354 buffer gets to get the remaining lines of the 13. Does anyone have an idea what could cause this?

    -Bobby

    Bobby Durrett says:

    The index includes all of the columns in which the clause in the order listed plus more. It's a local index.

    Most of the additional work is done in the index (see cr = value in the INDEX line).
    This suggests that you do a scan of interval by a large proportion if the index, but have a large number of entries.
    Two options in mind spring
    (a) there is a constraint in the where clause, which means your predicate is not as precise as it looks
    (b) there is a large strip of data recently removed from the index you're going through

    In both cases you can be the first return of these first two blocks of index leaf rows, then walk a lot index, do a lot of work, before going to the table for the last few rows.
    The suggestion to check the session statistics can give you some clues.

    Concerning
    Jonathan Lewis

  • I want to create a 2 cells in demand for numbers, the 1st cell is a dropdown menu with items of text, when choosing an item, that it would be represented by a numeric value in the other cell. How can I do?

    I want to create a 2 cells in demand for numbers, the 1st cell is a dropdown menu with items of text, when choosing an item, that it would be represented by a numeric value in the other cell. How can I do?

    You can use vlookup() like this:

    (1) crate a table like this:

    the first line is a heading row

    the first column contains the same list of items in the context menu

    the second column contains the corresponding values

    name of the table 'value '.

    In another table (where the pop-up menu), you can use the table of choice of 'Value' like this:

    create a drop-down list in cell B1

    Select cell C1 and type (or copy and paste) the formula:

    = VLOOKUP (B1, Value::A:B, 2, 0)

    short hand for this is:

    C1 = VLOOKUP (B1, Value::A:B, 2, 0)

    now change the pop-up to display the value in the change of cell C1

  • Hide the first and the last Division in the WPF chart axis

    I want to hide the default marker of the first and the last major division in an axis of a chart of WPF. I tried to extend RangeDivisionsMode and define my own class object to the MajorDivisions.Mode property on the axis. But even when I returns a list empty in RangeDivisionsMode.GetDivisions(...), the first and the last marker is drawn.

    Thanks in advance, Jonas

    The minimum and maximum labels are transmitted separately when displaying a scale (even if technical RangeDivisionsMode custom can be used for the minor divisions).

    There is no direct configuration option to hide extreme labels, but you can achieve this effect by initializing the LabelPresenter property on MajorDivisions by a custom implementation:

    class CustomFormatter : GeneralValueFormatter {

            protected override UIElement VisualizeCore( TData value, ValuePresenterArgs args, UIElement existingVisual ) {

                UIElement element = base.VisualizeCore( value, args, existingVisual );

    var axis = (Axis)args.Context;

                Range range = axis.Range;

                var comparer = range.Comparer;

                bool isExtreme =

                       comparer.Compare( range.Minimum, value ) == 0

                    || comparer.Compare( range.Maximum, value ) == 0;

                element.Opacity = isExtreme ? 0.0 : 1.0;

    return element;

            }

        }

  • Replace the index of an array with strings values

    I have a control table 2D (or indicator) CH x T: each cell of the table contains the voltage check for channel and time represented by the respective row and column.

    I would like to be able to scroll the data showing the names and time values to the Index screen instead of numeric values.

    For example, instead of see 0,1,2,3 etc. as line index values, I would like to see channel 1, canal2, canal3 etc..

    Is - it somehow possible?

    Any idea is welcome!

    Thank you in advance!

    See you soon.

    MG

    If you want to display the data in the form of a 2D array, but use channel & time as the Index display, you can use the rings of text and structure of the event.  You can reduce the table view if you only want to display one value.

  • IMAQ edge tool 2 'first + last edge' - returns the position of the first border

    I use 'IMAQ edge tool 2.vi' with the whole process in order to detect the 'first and last edge. It is obvious to edge coordinates the infromation seeing that it returns only a single point. Where are the coordinates of the last edge detection?

    Note: it detects the edges along the long green horizontal line, so there's at least 2 edges definitevely.

    Thanks for the tips.

    Martin

    Hey Martin,

    This may sound silly, but what happens if you scroll down to the following entry in your cluster? Currently, you can view information for your benefit '0' on the front panel. What happens if you are indexing at the edge '1' of your cluster and therefore see the information on the second edge. Is the cluster of empty when you look at the 'zero' edge? If it is, perhaps, the parameters of your step edge find are too strict and the step does not come back on a second advantage.

    If the problem persists, maybe post your vi sample and a sample picture will help clear things upward.

    I hope this helps!

    -Ben

Maybe you are looking for