Regexp substr to select the max number out an string

Hi all,
I need a solution for a query.
I,ve a query to select the lowest number in a string.
select regexp_substr('9 - 10','\d+')
from dual;
9
So this is the query I need to select the min number in he string.
but now I need it to give me the highest nr in the string .
the output that I need =10
Can someone help me pleasse?
My regards

Caroline wrote:
select regexp_substr('9 - 10','\d+')
from dual;
9
So this is the query I need to select the min number in he string.Actually it only gives you the first number in the string, not the minimum number.
SQL> select regexp_substr('9 - 10','\d+')
  2  from dual;
R
9If your string is the other way around it will give you 10 instead of 9.
SQL> ed
Wrote file afiedt.buf
  1  select regexp_substr('10 - 9','\d+')
  2* from dual
SQL> /
RE
10You probably want something like...
SQL> ed
Wrote file afiedt.buf
  1  with t as (select '9 - 10' as txt from dual)
  2  -- end of sample data
  3  select min(num) as min_num, max(num) as max_num
  4  from (
  5        select to_number(trim(REGEXP_SUBSTR (txt, '[^-]+', 1, level))) as num
  6        from t
  7        connect by level <= length(regexp_replace(txt,'[^-]*'))+1
  8*      )
SQL> /
   MIN_NUM    MAX_NUM
         9         10
SQL> ed
Wrote file afiedt.buf
  1  with t as (select '10 - 9' as txt from dual)
  2  -- end of sample data
  3  select min(num) as min_num, max(num) as max_num
  4  from (
  5        select to_number(trim(REGEXP_SUBSTR (txt, '[^-]+', 1, level))) as num
  6        from t
  7        connect by level <= length(regexp_replace(txt,'[^-]*'))+1
  8*      )
SQL> /
   MIN_NUM    MAX_NUM
         9         10
SQL>

Similar Messages

  • In Oracle 10g, what is the max number of values we can pass to  'IN' Clause

    Hi,
    In my SQL query i have a scenario like, i have to pass the values to 'IN' Clause dynamically from other application. I want to know what is the the max number of values i can pass to 'IN' Clause.
    i have searched in many pages i seeing answers like 'may be 1000' , 'not sure'....
    Could any one tell me the exact limit of IN Clause in 10g.
    Thanks in Advance.
    Chandran

    Hi, Chandran,
    Chandran M wrote:
    In my SQL query i have a scenario like, i have to pass the values to 'IN' Clause dynamically from other application. I want to know what is the the max number of values i can pass to 'IN' Clause.
    i have searched in many pages i seeing answers like 'may be 1000' , 'not sure'....Don't overlook [Dont want to know|http://forums.oracle.com/forums/thread.jspa?messageID=2683385&#2683385]. This may explain why people are reluctant to give a straight answer.
    Could any one tell me the exact limit of IN Clause in 10g.1000 items such as IN (1, 2, 3, ..., 1000)
    No limit on the number of sets: IN ((1), (2), (3), ...) *<=== NOT QUITE!* See below
    No limit in sub-queries: IN (SELECT ...)
    Edited by: Frank Kulash on Jun 3, 2009 9:43 AM
    The limit of 1000 applies to sets of single items: (x) IN ((1), (2), (3), ...)
    There is no limit if the sets contain two or more items: (x, 0) IN ((1,0), (2,0), (3,0), ...)
    Thanks to Michaels for pointing this out.
    Edited by: Frank Kulash on Jun 3, 2009 10:22 AM
    Fixed link

  • What is the max number of hyperlinks supported in a PDF docment?

    What is the max number of hyperlinks supported in a PDF docment?
    How do I find out how many hyperlinks there are in a PDF document?

    I don't think there's a limit to the number of links you can add to a file...
    This code (taken from the reference files) will report the number of links in your file:
    var numLinks=0;
    for ( var p = 0; p < this.numPages; p++)
    var b = this.getPageBox("Crop", p);
    var l = this.getLinks(p, b);
    console.println("Number of Links on page " + p +" is " + l.length);
    numLinks += l.length;
    console.println("Number of Links in Document is " + numLinks);

  • Finding the Max Number

    Hi All,
                     I have table from which i have to find out the site and its max number.i fetch all the data in ITAB. now i am not understanding wat to do to find the max number.here is my problem...
    Site              Number
    1001             2
    1001            1
    1001            5
    1001           50
    1001         30
    1002          1
    1002          100
    1002          10
    now i have all this data in my ITAB and den it is printing in my alv.
    now i want data to be like this...
    Site            Number
    1001          50
    1002         100
    plz tell me wat to do...as i am very new in this area.
    Thanx,
    Vaneet
    Moderator Message: Basic Post. Put some effort of your own first.
    Edited by: kishan P on Dec 10, 2010 3:42 PM

    Pretty straigth forward.
    Just sort the internal table by site number descending. That way you know you always have the highest number in the first record for the site.
    sort itab by site number descending.
    loop at itab.
      at new site.
         itab2-site = itab-site.
         itab2-number = itab-number.
         append itab.
      endat.
      continue.
    endloop.

  • What is the Max Number of Total Work Process that we can Have on  One C.I

    Hi,
    What is the Max Number of Total Work Process that we can have on a Single C.I
    Is there any Limit that We can only have Perticular Number of Total work process ?
    Or it is just Unlimited number of total work process
    Thanks & Regards
    Dan.

    from the system throughput point of view a rule of a thumb is:
    1 up to 4 sometimes 5 workprocesses per CPU.
    (one is used in Benchmarks where you have a very small number of transactions running with a small amount of database accesses)
    you can easily find it out:
    configure 4 WPs per CPU. If you have a number of WP's consuming nearly no CPU time you can reduce the number of WPs.
    regards
    Peter

  • How do I find the max number of sessions ever recorded?

    Hi,
    I see sessions_highwater column in v$license shows the max number of sessions since the database startup time, but I'm wondering if there is a view that shows the max number of sessions ever recorded? (i.e. before the last database restart)
    Thanks!
    Jon

    You can check the number of sessions from the below query using hist views. But you can only go back upto  the retention policy setting.
    SELECT   res.snap_id, s.begin_interval_time, s.end_interval_time,
             res.instance_number, res.resource_name, res.current_utilization,
             res.max_utilization
        FROM dba_hist_resource_limit res, dba_hist_snapshot s
       WHERE s.snap_id = res.snap_id AND res.resource_name = 'sessions'
    ORDER BY s.begin_interval_time, res.instance_number

  • Why the window setting the printing disappeared when I try to select the page number of pdf file

    When I send the pdf file to the printer and try to select the page number to be printed by entering (e.g., 4-10), the page for setting up printing work suddenly disappeared.   As a result, I could only print pdf files from page 1 to the end, if I want to print any document.   I have no problem with printing word documents.  Thus, it should not be problems related to printer, right ?
    Your help is highly appreciated !

    What is your operating system?  Reader version?
    You mean the Print panel completely disappears when you enter some page numbers?

  • How to change the max number of member display in Target Group

    Dear Experts,
    We are using 2007 CRM Marketing.
    When I search and open a Target Group it displays me maximum of 100 entries of members over 11 pages. how do I increase or decrease the max number.
    Appricate you help.
    Thanks,
    Shabbir Hussain

    Hi,
    you can set the number of members that will be displayed in target group.
    Go to any profile group -> open the graphical modelling -> open settings.
    Here you can ajust the displayed number of members in a targetgroup.
    These settings are user-dependent and saved in table CRMD_MKTTG_PERS.
    Regards,
    Claudia

  • How to select the max rowid from a subquery with group by

    Hi Gurus,
    Kindly help how to fix the following query because I'm getting Oracle error:ORA-01446.
    select * from edy_raw_data a
    where rowid in ( select max(rowid) from(
    select email,max(date_updated) from edy_raw_data b
    where b.email=a.email
    group by email ))
    The query select the max rowid from a sub query with group by.
    Thanks in Advance.
    Benjie

    Why do you need to compare with rowid?
    Wouldn't this suffice?
    select * from edy_raw_data a
    where (email,date_updated) = (select email, max(date_updated) from edy_raw_data b
                        where b.email=a.email
                        group by b.email ))* Note: untested

  • What's the max number of columns a table can have on 32 bit OS & 64 bit OS

    What is the max number of columns a table can have on 32 bit OS & 64 bit OS ?
    Edited by: sameer naik on 02-Jul-2010 02:11

    For TimesTen 7.0 and 11.2.1 releases the limit on the number of columns per table is 1000 for both 32 and 64 bit TimesTen. This can be found in the documentation under System Limits.
    Regards,
    Chris

  • "Numbers" when creating a sheet the max number of rows is only 255, is this correct because i thorght is was something like 65,000

    "Numbers" when creating a sheet the max number of rows is only 255, is this correct because i thorght is was something like 65,000

    max columns is 255
    max rows should be 65535

  • E-edition freezes up with 1A.pdf The max. number of files are already open no other files can be opened or printed until some are closed , showing four of five and computer froze any I must close by shutting down manually.

    My online E-Edition newspaper will freeze up after loading the front page and gives me the message that the max. number of files are already open and no other files can be printed or opened until some are closed. 1A.pdf. When you click ok it repeats itself and you have to force shutdown by holding off button. I'm totally stumped.

    I have read that "1000" is default maximum for Acrobat 4 or Acrobat 5 (I don't remmember it exactly anymore). Concerning my PC and RAM. I have a high-end graphical computer at my office; so I'm sure the RAM memory is not the reason.
    Anyway, thanks for answer.

  • How to change the max number of the user session?

    Hello,
      The max number of the user session of my system is 6,I want to change it,how should I do?

    Hi Begue,
    This can be done by changing the value of profile paramter rdisp/max_alt_modes. Currently its value in your system must have been set to 6. You can check the value through transaction RZ11. To change it use transaction RZ10.
    For knowing the details of changing values in RZ11 please visit :
    http://help.sap.com/saphelp_47x200/helpdata/en/c4/3a6247505211d189550000e829fbbd/frameset.htm
    After making the changes please restart SAP.
    Please award points if the issue got solved.
    With Regards.
    Ruchit.

  • The max number of simultaneous active connections

    Hi. We have a 4x NT server running Weblogic 4.5.1 with the performance pack
    enabled. We can only get about 7 or 8 active simultaneous connections in our
    tests (using LoadRunner with 50 users). The app server log, on startup,
    records that 8 native threads are assigned to the server. We are wondering
    if there is a relationship here.
    We have bumped up the "executeThreadCount" value from the default of 15 and
    have not seen any change.
    Thanks in advance.
    Bill Kline

    Hi Rob.
    We are running on a 100Mbps network. It is alot of data though.
    The servlet is to just drive our the backend components so we can have some
    idea of their performance without the rest of the system there. We are still
    seeing the same behavior with it. We are switching to a scenario with more
    of our midtier components in place. This setup uses a JSP page that drives
    an EJB that is the interface to the system.
    There is still a possibility though that a servlet may come into play in
    some scenarios.
    - Bill
    An EJB will be In a deploymnet there will be an EJB
    Rob Woollen <[email protected]> wrote in message
    news:[email protected]...
    Bill Kline wrote:
    Hi again Rob.
    It appears that its something to do with the servlet that we wrote to
    drive
    the backend for the tests. I've enclosed a test servlet that is similar,
    except it doesn't do anything except send back about 35K of data. Itshows
    the same behavior as the one that actually drives our stuff (that isabout
    35 TPS).
    35K is a relatively large servlet response. Is this typical for your
    application? Also, if I understand correctly, you are sending 35K / tx ** 35
    trans / s which is ~ 1MB / s. What sort of network connection is thisover?
    >
    Let me know if you are still having problems.
    -- Rob
    The round trip (a transaction) is from load runner to the servlet (via a
    POST) and the response from the POST.
    Thanks for your help so far.
    Bill Kline
    [email protected]
    Rob Woollen <[email protected]> wrote in message
    news:[email protected]...
    Bill Kline wrote:
    Hi Rob.
    Yes its a 4 CPU NT server.
    The connections are not refused. They all get accepted, but only 7-8
    are
    actively being serviced, while the others wait.Can you provide some more detail about your architecture? Forinstance,
    what is Load Runner measuring (ie what does a round-trip entail, what
    is a
    transaction?)
    -- Rob
    The CPUs are not busy. I
    believe the max CPU utilization that has been recorded is around
    60%,
    but
    its often lower (performance recoding is done using PerfMon). Our
    main
    concern is that we cannot max out the CPUs, so something isthrottling
    things.
    In the tests we can get about 30-34 transactions per second (tps)with a
    transaction being a round trip recorded by Load Runner. The 30 tpsvalue
    is
    pretty consistent. If we crank up the number of users (say to 150)
    we
    still
    get 30 tps, but the time for a transaction increases rather
    dramatically
    (to
    over 10 seconds). The CPU utilization never really changes. The 30
    tps
    value
    is also very consistent over time. We've run some 10 hour tests.
    I was wrong on the "executeThreadCount" not making a difference. I
    found
    out
    that increasing it to 50 from the default of 15 bumped up thetransaction
    rate initially but only by a couple of percent. The rate fell afterawhile
    back down to the magic 30 tps range. The fellow running the test
    tried
    an
    executeThreadCount value of 300 once and saw no real affect.
    Thanks for your time.
    - Bill Kline
    Rob Woollen <[email protected]> wrote in message
    news:[email protected]...
    Bill Kline wrote:
    Hi. We have a 4x NT server running Weblogic 4.5.1 with the
    performance
    pack
    enabled. We can only get about 7 or 8 active simultaneous
    connections in
    our
    tests (using LoadRunner with 50 users).What happens when there are > 8 connections? Are the
    connections
    refused?
    The app server log, on startup,
    records that 8 native threads are assigned to the server. We arewondering
    if there is a relationship here.No, not really. On NT, we assign roughly 2xcpu threads for
    native
    io
    processing. I suspect that you have a 4 cpu system.
    -- Rob
    We have bumped up the "executeThreadCount" value from the
    default of
    15
    and
    have not seen any change.
    Thanks in advance.
    Bill Kline
    Name: TServ.java
    TServ.java Type: unspecified type (application/octet-stream)
    Encoding: x-uuencode

  • How to select the series number in a document

    My customer needs to record invoices and orders and payments with date in 2009 and in 2010 too.
    How do we define this scenario in SAP?
    I am in version 2007 PL00 SP 48.
    Kind regards.
    Agustín Marcos Cividanes

    Hi Giri
    >> First define the Posting Period for 2010 and create the numbering series for documents for 2010.
    Done.
    >> set as default of numbering series for 2010.
    Done.
    so this series will come defaultyly,if u want to post some document in 2009 then select the numbering series in documents manually,
    >> How?
    I am trying with a FMS to update the invoice and it's ok, but the journal entry takes 2010 number series.
    I have:
    - one serie DEC09.
    - other JAN10.
    I want to record invoices with date in Dec 2009 now and the journal entries with DEC09 serie, and invoices with date in Jan 2010 and the journal entries with JAN10 at the same time.
    Is this possible?
    Kind regards.
    Agustin Marcos Cividanes

Maybe you are looking for

  • GPU Upgrade Time - What are my options? 10.6.8 MacPro4,1

    Hi there, First time posting I found this thread but it didnt answer my questions. https://discussions.apple.com/thread/3768820?start=0&tstart=0 Do I have to use the two models available via the Apple store (5870 and 5770)? Do I have the PCIe2.0 slot

  • Reader 9.4 will not allow saving completed Form from Pro v8

    I've just created a new form that Reader 9.4 will not let me save the completed changes on.  It will only allow viewing, modifying, printing, but not saving the changed form content.  If I open it with Pro v8, it works fine. I opened some forms I cre

  • Reading result table using LDB and event get payroll

    Hi Technical experts, I need help regarding reading cluster RT using logical database pnp and event get payroll. Please help me out. Best Regards. Priyaranjan

  • Mvt. 101 with ML81N for service entry sheet split for every service line

    Dear guru. I have one purchase order position for service (item category D)  with three different service line. I run ML81N and i create the service entry sheet for every service line. If I see the goods receipts movement generate , the system show 1

  • DML(Update)  in a report

    I have a report, with a query that includes a ROWNUM, How can I do UPDATE of the table of the query with the printed rownum? For example, query report is: SELECT rownum, a.* from mytable a order by ......; I have to UPDATE one of column, say x of my