Need help in finding the number of occurrences of a pattern.

Hi All,
I need help in finding the number of occurrences of a pattern in a table's column's data.
Consider sample data - one row's column from a table:
"S-S-S-A-S-S-P-S-S-B-S-A-P-S-S-C"
My requirement is:
I should get the count of S's which are immediately preceded by A or P.
for the above data i should get count as 3+2+1=6 (S-S-S-A, S-S-P, S-A)
The pattern data is stored as VARCHAR2 type.
Thanks in advance,
Girish G
Edited by: Girish G on Jul 21, 2011 11:22 PM

I am sure there exists a better way then this one:
SQL> with dt as
  2  (select 'S-S-S-A-S-S-P-S-S-B-S-A-P-S-S-C' str from dual)
  3  SELECT SUM(Regexp_count(Regexp_substr(str, '(S\-?)+(A|P)+', 1,
  4                                     Regexp_count(str, '(S\-?)+(A|P)+') - (
  5                                                  LEVEL - 1 )), 'S')) len
  6  FROM   dt
  7  CONNECT BY LEVEL <= Regexp_count(str, '(S\-?)+(A|P)+')
  8  /
       LEN
         6

Similar Messages

  • I need help to find the serial number for Photoshop Elements 11

    Hi! I need help to find the serial number for Photoshop Elements 11 I downloaded last year on Apple Application Store.. I have been using photoshop on mac for over a year and now need the serial number to be able to use it on macbook. I looked up Adobe's website for help but found none and noone to ask for support.. Any ideas how I can get the serial number using the App Sore bill I have?

    Please post Photoshop Elements related queries over at
    http://forums.adobe.com/community/photoshop_elements

  • Need help to find the "leading point size"

    Hi,
    I need help to find the "leading point size".
    Any para style leading is more than 2 points of my font size, I need the alert message "Its more than 2 points for your font size". For instance my para font size is 10 here my leading should be 12 points rather than its 14 points, I need the alert message.
    Is this possible by script?
    by
    hasvi

    Hi Hasvi,
    Try this.
    var doc = app.activeDocument;
    var texts = doc.stories.everyItem().textStyleRanges.everyItem().getElements();
    var pstyle = "Following paragraph styles have more leadings:\r\r";
    for(var i=0;i<texts.length;i++)
        var ps = texts[i].pointSize;
        if(texts[i].leading > ps + 2)
            pstyle += texts[i].appliedParagraphStyle.name;
    alert(pstyle)
    If it is correct than mark the answer as correct and don't mark your question as correct answer.
    Regards,
    Chinna

  • Need help to find the correct .MIB-file

    Hi.
    We are using some Nexus 7009 chassis on my work and a program called "SNMPc" that receives traps from our Nexus devices.
    The program do not have the new Nexus 7000 MIBs so we are only getting "pure text" from Nexus.
    We need to download the right type of MIB file so we can get a better understanding of what is happening on the Nexus.
    We can ONLY use ".mib" extensions but Cisco currently only offering ".traps", ".my" and ".oid" files what I can find.
    This is an example message we get:
    ciscoMgmt.706.0.1 [1] ifName.437260288 (DisplayString): Ethernet3/2 [2] ciscoMgmt.706.1.1.0 (Integer): 5 [3] ciscoMgmt.706.1.2.0 (Integer): 5 [4] ciscoMgmt.706.1.3.0 (Integer): 5 [5] ciscoMgmt.706.1.4.0 (Integer): 5 [6] ciscoMgmt.706.1.5.0 (Integer): 5 [7] ciscoMgmt.706.1.6.0 (Integer): 5 [8] ciscoMgmt.706.1.7.0 (Integer): 5 [9] ciscoMgmt.706.1.8.0 (Integer): 4 [10] ciscoMgmt.706.1.9.0 (Integer): 5 [11] ciscoMgmt.706.1.10.0 (Integer): 5 [12] ciscoMgmt.706.1.11.0 (Integer): 5 [13] snmpTrapEnterprise.0 (ObjectID): ciscoMgmt.706
    We can see that the trap name is: 1.3.6.1.4.1.56.12.1.1.0.1
    Can someone help me get the right MIB?

    Silly question but have your tried changing the file extension of the .my files to .mib  ?  I typically have to do something like that for net-snmp with Cisco MIB files...
    - Be sure to rate all helpful posts

  • Need help in finding the position of a SubString in a String

    Hi All,
    I have a VARCHAR2 column in my table which has data similar to '152-425-3265-8-5623-45'.
    I want to find the position of the numbers in the column.
    For example:
    If i give 8 - query should return me 4.
    If i give 425 - query should return me 2.
    The numbers are delimited with '-' value.
    Please help.
    Thanks in advance.
    Edited by: 868171 on Jun 24, 2011 4:33 AM
    Edited by: 868171 on Jun 24, 2011 4:34 AM

    do you know the max number of dashes?
    if so
    with t as (select  '152-425-3265-8-5623-45' code, '425' num from dual union
                   select  '152-425-3265-8-5623-45' code, '8' num from dual)
    select code, num, case num when  regexp_substr( code,'[^\-]+',1,1) then '1'
                   when  regexp_substr( code,'[^\-]+',1,2)  then '2'
                   when  regexp_substr( code,'[^\-]+',1,3) then '3'
                   when  regexp_substr( code,'[^\-]+',1,4)  then '4'
                   when  regexp_substr( code,'[^\-]+',1,5) then '5'
                   when  regexp_substr( code,'[^\-]+',1,6)  then '6'
                   else 'not found' end result
    from t
    CODE     NUM     RESULT
    152-425-3265-8-5623-45     425     2
    152-425-3265-8-5623-45     8     4or if you have 11g you can use regexp_count
    with t as (select  '152-425-3265-8-5623-45' code, '425' num from dual union
                   select  '152-425-3265-8-5623-45' code, '8' num from dual)
    select code, num, regexp_count(regexp_substr(code,'^.*'||num||'.'),'-')
    from tEdited by: pollywog on Jun 24, 2011 7:55 AM

  • Need help in Controlling the Number in SAP Script.

    Hi,
    I am writing a Report using the the Sap Scripts.
    I want to show the Number "1" as "1.00" in the print out which is comming from a SAP Script.
    Can u please help.
    with rgds
    Ranjith Singh

    Ranjith,
    I was came across similar condition few years back, I guess you need to change the data type or else call a PERFORM from your sap script if it is custom.
    Regards,
    Amey

  • Need Help in finding the Menu Path's for the below topics

    Hi,
    Where can i get the menu paths for the below topics in SAP syste. I have searched in the system,But couldnot find the Menu Path's for the below topics.Kindly help me in finding the configuration Path for the below...
    1)Public tendering process
    2)Grants Management
    3)Tax & Revenue management
    4)Public sector accounting --> Budget formulation, preparation, execution & Monitoring.
    Thanks
    Rajitha M

    Hi,
    Check for the relevant path in IMG in Public Sector Management.  The prerequisites being configuration of Financial accounting
    sub modules.
    Best Regards,
    Sadashivan

  • Need help in finding the root cause the error 'Could not find function:'

    Hi fokls,
    In my workflow notification , when I click on the notification to process it , it says ' 'Could not find function:' error.
    I found the this message is coming out from the Fnd_new_messages table from the message_name 'FND_FUNCTION_NOT_FOUND'.
    Here are my questions ...
    1. FND_FUNCTION_NOT_FOUND - Is it a oracle Seeded message ?
    2. If so the error I am getting is a oracle product Bug ?
    And In between , I am getting this error for few transaction only. ( out of 100 , i am getting this error at the rate of 5 per 100 ... or less)
    3 .If its a oracle product bug then , how is 95 out of 100 transaction are succssfully wokring ?
    4. If is a custom bug , how it os not though for some other 95 transaction ?
    5. Can I expect it as Data issue ? If so what kind of data issue.
    Folks , any kind of info will be really , realy helpful for me ... please let me know your inputs for me.
    Thansk to all in advance
    Raghu

    In the error message 'Could not find function:' after colon what function name it is giving.
    'FND_FUNCTION_NOT_FOUND' is a seeded message only.
    As you are saying the error was throwing only for 5% or less notifications, is the error throwing for same kind of notifications? I mean the item type and message are same for these erroneous notifications?
    It can be that some function in particular type of workflow is error-ed out does not exists, when responding to those kind of notifications it might be throwing error.
    Please check that.
    Edited by: sarojak on Nov 12, 2010 6:16 AM

  • I need help on finding the right video camera

    I am a high school student and I make short films. I use final cut express. I'm getting ready to do a short film for a film festival. I really want a new video camera but i don't know what to get. The price range is under 2000. If anyone knows what would be the best i would really appreciate the input.
    Thanks

    At the moment i have been using a Sony GC1 for small stuff but other videos i use a panasonic, im not sure of the name i don't have it with me.
    The quality is really bad on the sony mainly because its just a net sharing cam and the panasonic is not mine so i dont have full access.
    I really want something with good quality, 24p, can work with my macbook, just an overall good camera that will endure a lot of use.

  • Bad game performance: "Tibia" - need help to find the error

    hi
    im playing a game called tibia (www.tibia.com) for a long time, back on windows i had no problems with the programm(except that windows itself crashed sometimes while playing ;P).
    since some time they made an linux client again and i tryed it on my pc, running arch with all updates.
    my problem is that sometimes when (probably to much) pictures like garbage and player are shown on the screen(its an 2d mud inspired by ultima) i get performence issues, the program is freezing 2 seconds before i can view another level, just to say an example.
    via "top" i watched what kicks in that uses my cpu so much and it is X.
    ok, now i dont realy know where this post belongs, more here or into newbie's corner, but:
    as i said before i have every possible update for arch and the installed programms.
    i got an geforce fx 5200 with the newest driver(manualy installed because the installer via pacman whont have the new driver because of an outdatet kernel, atleast that was what i remember).
    my problem now is that i just dont know where the error is.
    i know of people, using the same client as i that dont have that issues.
    i already bugged the support forums but as far as i saw they dont realy like arch user, atleast they dont answer to their questions. ;P
    i whant to know if MAYBE someone is here who plays tibia and can tell me that he got the same problems like i do or not.
    or you could give me hints what i could try to solve this problem.
    to write it in one short line:
    the problem is that the process "X" sometimes kicks in, using 100% of the cpu, this happens only while playing "tibia"
    thank you

    Look at Steps #4, #6, #9 and #12.
    http://helpx.adobe.com/dreamweaver/kb/troubleshoot-javascript-errors-dreamweaver-cs4.html
    Nancy O.

  • Need help to find the table which stores the infomation listed below

    Hi,
       I am working on Archiving work for archiving the data under the tcode SOST.I searching the table which stores the email document content but I am having difficulty to get the table..Could any one provide some input on this.
    Thanks.
    ~Donny

    I believe it is stored in table SOFFCONT1

  • How to find the number of occurance of a string in text field of Infopath form?

    Hi All,
    In Infopath text field, How to find the number of occurrence of a particular string in that field?
    Thanks in advance!

    You can check to see if it contains a string once by using the contains function, but there isn't a very clean way to do what you want. If you wanted to guess at the maximum number of occurrences, then you could:
    Box A has your initial. Set Box B to do a concat of string-before and string-after of Box A where it copies Box A minus the string we're looking for. Then we have Box C that does the same thing to Box B. Repeat as many times as you see necessary.
    Example:
    String: "1"
    Box A - "123451234512345"
    Box B - "23451234512345"
    Box C - "2345234512345"
    Box D - "234523452345"
    etc.
    We then have a field that has nested ifs looking backwards from Z -> A looking for a non-blank. Based on that, we return the number of occurrences. Again, this isn't clean, but it will work if you think there's a predefinable maximum.
    Andy Wessendorf SharePoint Developer II | Rackspace [email protected]

  • Hi.I need help.my iphone was Stolen .how can I get back my iphone. Serial No.DX*****PMW.could you help me find my iphone.thank you very much.could you send me the ICCID number to help me find the iphone

    Hi.I need help.my iphone was Stolen .how can I get back my iphone.  Serial No.DX******PMW.could you help me find my iphone.thank you very much.could you send me the ICCID number to help me find the iphone.if you can help me.
    <Personal Information Edited by Host>
                                                                                                                                                                   Sincerely a Chinese girl really need your help

    Sorry we are all users on this User  Community No Apple Staff
    Read this .
    http://support.apple.com/kb/HT2526
    Apple do not and cannot assist in finding stolen property ,that is the responsility of your Police

  • Need help in finding mpeg2 component number to unlock key so I can burn a dvd?

    Need help in finding mpeg2 component number to unlock key so I can burn dvd?? I have premiere elements 3.0
    Thanks,
    sylvia

    Sylvia,
    I cannot comment on PrE 3, as I did not start until PrE 4. With the latter, when one went to use one of the modules, they were automatically "registered." Based on comments in the Help file, I asked pretty much this same question, back then. All was done automatically, in PrE 4.
    Maybe those, familiar with PrE 3, can be of help to you.
    Good luck,
    Hunt

  • Need help to find photo's on my backup drive,since installing Mountain Lion cannot find where they are stored.The backups after ML install are greyed out except in Applications, MyFiles and Devices really welcome a hand with this please.

    I need help to find my photo's please (2500) on my backup drive.Lost them after doing a clean install of Mountan Lion I have tried to find them but had no luck.  I use Time Machine with a 1TB Western Digital usb drive. Thanking anyone in anticipation of a solution.

    -Reece,
    We only have 1 single domain, 1 domain forest, no subdomains, only alias. I had replied to the other post as well. But I am happy to paste it here in case anyone want to read it.
    So, after a few months of testing, capture and sending logs back and forth to Apple Engineers, we found out there is a setting in AD, under User Account that prevent us to log into AD from Mountain Lion. If you would go to your AD server, open up a user account properties, then go to Account tab, the "Do not require Kerberos preauthentication" option is checked. As soon as I uncheck that option, immediately I was able to log into AD on the Mac client. Apple engineers copied all my AD settings and setup a test environment on their end and match exact mine AD environment. They was able to reproduce this issue.
    The bad part about this is... our environment required the "Do not require Kerberos preauthentication" is checked in AD, in order for our users to login into some of our Unix and Linux services. Which mean that it is impossible for us to remove that check mark because most, if not all of them some way or another require to login into applications that run on Unix and Linux. Apple is working to see if they can come up with a fix. Apparently, no one has report this issue except us. I believe most of you out there don't have that check mark checked in your environment... Anyone out there have any suggestion to by pass or have a work around for this?

Maybe you are looking for