Problem in Getting count

Hi All,
ill be giving a string for my query in the runtime and also ill number the each and every letter in the string according to its position in the string. I need to calculate the count of the letter in the "string".
All izz Well
GTA

You mean something like...
SQL> ed
Wrote file afiedt.buf
  1  with t as (select 'aharry' as txt from dual)
  2  --
  3  -- end of test data
  4  --
  5      ,c as (select rownum rn, substr(txt,rownum,1) as ch
  6             from   t
  7             connect by rownum <= length(txt))
  8  --
  9  select rn, ch, count(*) over (partition by ch) as cnt
10  from c
11* order by rn
SQL> /
        RN C        CNT
         1 a          2
         2 h          1
         3 a          2
         4 r          2
         5 r          2
         6 y          1
6 rows selected.

Similar Messages

  • Problem in Getting Count answer for the report in OBIEE 11g..

    Hi friends,
    I created a report in OBIEE 11g, but i'm not getting the correct answer as i expected...I'm getting answer in presentation services but the answer is wrong..
    I'll explain to you with an example report: Suppose in the report "NATIONALITY COUNT IN DEPARTMENT WISE" manner
    i dragged the Nationality column from per_all_people_f which is dim table and i dragged the column that i applied aggregation rule "count" for the column "nation count" from per_all_assignments_f which is fact table......If i viewed answers means i'm getting correct answer
    (i.e.) nation count per Nationality..........
    NATIONALITY<---------------------->NATION COUNT
    AUSTRALIA 40
    INDIA 20
    AFRICA 10
    USA 5
    The above is the answer I'm getting with out including the department column from hr_all_organization_units...........
    But since according to the report i need count in department wise manner, so for that along with nationality and nation count column i dragged department column from hr_all_organization_units which is dim table and also i hide that column as i dont want to view the department column in answers..........
    If i clicked answers, means then I'm not getting the nation count for the nationality......... I'm getting the answer 0 for each and every nationality, if i included the hided department column
    NATIONALITY<----------------->NATION COUNT
    AFRICA 0
    AUSTRALIA 0
    INDIA 0
    USA 0
    I'm getting answers like the above if i include the department dimension column which is in hided manner.........................
    What is wrong with it........Whether i made any logical mistake for the report.....If so guide me friends..........
    Cheers,
    Harry...........

    Hi,
    you said about writing query in DB.......whether U meant of trying checking the query in toad..or something else..........
    Since im giving only one join from dim to fact in the physical diagram........
    But more than one join exist between those dim and fact, but im giving only one join mainly the primary key column of the dimension table to the fact table....Whether i need to give all the joins that exist(even if it has 2 or 3 joins between those fact and dim) tables....
    If i give count distinct means it is giving count for every nation as 1....like i mentioned below
    NATIONALITY<----------------------------------------------------->NATION COUNT
    INDIA---------------------------------------------------------------------1
    AUS------------------------------------------------------------------------1
    CAN------------------------------------------------------------------------1
    Since you said to check about depts of the particular column....i couldn't able to understand about "depts" that you meant????
    Whether i made any logical mistake...........
    thanks,
    Harry...
    Edited by: HariPrasad on Oct 10, 2010 9:55 PM

  • Problem to get count from resultset with select count(1) like query

    Hi,
    The snippet of code is like this ...!
    preparedStatement = connection.prepareStatement("select count(1) as count from acf_users where acf_user_name like ? and acf_user_password like ?");
    preparedStatement.setString(1,stringUsername);
                   preparedStatement.setString(2,stringPassword);
                   resultSet = preparedStatement.executeQuery() ;
                   System.out.println("The ResultSet Count checkUser() : "+resultSet.getString("count"));
                   preparedStatement.close();
    But there is a SQLException like :
    java.sql.SQLException: ResultSet.next was not called
    I want to extract and check the count in the program..
    Does anyone has the solution, comments on this.
    Thanks in Advance,
    -Sachin

    Thanks a lot to have a look on it :
    I got the solution on it as :
    preparedStatement = connection.prepareStatement("select count(*) as total from acf_users where acf_user_name like ? and acf_user_password like ?");
                   preparedStatement.setString(1,stringUsername);
                   preparedStatement.setString(2,stringPassword);
                   resultSet = preparedStatement.executeQuery() ;
    resultSet.next();
                   System.out.println("The ResultSet checkUser() : "+resultSet.getInt("total"));
    The important line is :
    resultSet.next()
    Thanks once again,
    Sachin !

  • Invoke-Command Get-Counter

    Hi
    I'm trying to run some code on remote computers that use get-counter. But the problem is when the data is returned the CounterSamples is not as expected and the data is just:
    Microsoft.PowerShell.Commands.GetCounter.PerformanceCounterSample
    What am i doing wrong?

    True :)
    When i run this:
    $data = get-counter "\Memory\Available kbytes"
    $data.CounterSamples
    I get this:
    Path                                    InstanceName                                
                           CookedValue
    \\hyp20\memory\available kbytes                                                                  
                 52592044
    When i run this:
    $data1 = invoke-command -computername hyp20 -scriptblock {get-counter "\Memory\Available kbytes"}
    $data1.CounterSamples
    I get this:
    Microsoft.PowerShell.Commands.GetCounter.PerformanceCounterSample
    Do you need to use the results for some further use? If not, what happens when change the Invoke-Command line to:
    Invoke-Command -ComputerName hyp20 -scriptblock {
    $data = Get-Counter "\Memory\Availabile kbytes"
    $data.CounterSamples
    Jason Warren
    @jaspnwarren
    jasonwarren.ca
    habaneroconsulting.com/Insights

  • Hi, I have a problem with getting my apple Id working for me. It's been 2 months since it happened and Apple failed to act. I can tell my story proerly, but am not sure, you guys can help, so I just copy my message to them today, I am trying to get it acr

    Hi, I have a problem with getting my apple Id working for me. It's been 2 months since it happened and Apple failed to act. I can tell my story proerly, but am not sure, you guys can help, so I just copy my message to them today, I am trying to get it across all the places around to pay their attention. This is a desperate move, so if you are not the right people to help me to get my message accross, may be you can advise where can I go.
    Thank you, and sorry for the language.
    Vitas Dijokas
    I am sorry to say that, but your security makes my life miserable – it’s been 2 months since my Apple ID account got stuck, and since then I cannot update 37 applications (to date), i.e. most of my applications. Half of them I bought. I also paid for iCloud, and it is not working. I paid money and I am stuck with old applications and no iCloud. Your security *****. Your service ***** too. It took your service 1 month to finally understand why this happened to me, and it took me tens of emails to you and 3 hours of telephone conversation to find out the reason for my problem. And the problem is still not fixed. NOT FIXED. You just leave your customer – the one who paid you money and spent so much time with you trying to help you help me – and nothing. You tell me:  “Vitas, Stick your stinky iphone in your *** and enjoy life, we do not care!” *************.
    It is ******* outrageous, and you should know that,  guys. Get into the ******* database and correct the bug. Get someone in the partners-telephone carriers company (it is Orange as carreer and Cellcom as seller of the phone)  authorized to Identify me in personal encounter in one of the branches in Israel (where I live) and make sure it is really me, and get the ******* system accept my password and let me use my phone.
    Otherwise **** off. None of my friends will get my advise to buy an iphone or any of apple products. And I think you should be very attentive to cases like this, guys. Do your work for the money we pay, or disappear. There are many others eager to take your place, and if the problem is not fixed I will eventually go to the others. My patience is lost, and as soon as I can afford another phone I will change it. AND I WILL TRY TO GIVE BAAAAAD PUBLICITY TO APPLE – I am threatening here, so ACT NOW.
    Vitas Dijokas

    Well, it seems waiting is not my strong suit..! I renamed a javascript file called recovery to sessionstore. This file was in the folder sessionstore-backups I had copied from mozilla 3 days ago, when my tabs were still in place. I replaced the sessionstore in mozilla's default folder with the renamed file and then started mozilla. And the tabs reappeared as they were 3 days ago!
    So there goes the tab problem. But again when I started mozilla the window saying "a script has stopped responding" appeared, this time the script being: chrome//browser/contenttabbrowser.xml2542
    If someone knows how to fix this and make firefox launch normally, please reply! Thank you

  • I know many have this issue but i can't find a solution to the problem. i get message saying insuffisiant disk space in the volume iPhoto library and i have plenty of space available. i have the new macbook pro with retina display.

    I know many have this issue but i can't find a solution to the problem. i get message saying insuffisiant disk space in the volume iPhoto library and i have plenty of space available. i have the new macbook pro with retina display. i have never seen this message before and i have 2 other macbooks and have had many other also. i am assuming this is a problem with the new macbook retina. does anyone know the exact fix to this issue? i have seen many sugestions to try to fix this issue but none have solved the issue for anyone that i can find in the Apple Support Community. thank for looking into this in advance.
    ******A true apple fan********

    Actually your suggestions are the ones that i have tried. i have seen that you have tried to help others with this issue and the only one that i could find that said they found the problem said that it was an ilife update issue and it fixed it and i have no available updates. i know it has to do with something in photo stream because it happens when i create a new library and it is loading the photos but i get the message before i reach the maximum 1000 photos. so i've tried updating, new library(first backing up photos and then deleting them from iPhoto), reinstalling OSX many times, running disc utilities. I called Apple the first day i had this issue and i was the first person to call them for support with the retina display and i actually had it escalated to a senior advisor and we thought we fixed the problem but we did not. i am pretty fluent in dealing with troubleshooting these type of issues and this is the first time i'm reaching out to the community. i figured now that the retina has been out some time now that there would be an obvious answer to this issue. thanks for the quick reply.
    Bebers5

  • Problem in getting the database connection from a connection pool

    Hai All,
    I am facing a problem in getting the database connection from a connection pool created on weblogic server 8.1.
    I am using the Oracle database 8.1.7.
    I have configured my connection pool, datasource and JNDI in weblogic.
    In my java program i have the following code to retrieve the connection.
    import java.sql.*;    
    import java.util.Hashtable;
    import javax.naming.Context;
    import javax.naming.InitialContext;
    class jdbcshp1 {
        public static void main(String[] args) {
         Connection connection = null;
         try {
               Hashtable ht = new Hashtable();
               ht.put(Context.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.WLInitialContextFactory");  // Wanna get rid of this.
               ht.put(Context.PROVIDER_URL,"t3://localhost:7001"); // wanna get rid of this.
               // Get a context for the JNDI look up
               Context ctx = new InitialContext(ht);
            javax.sql.DataSource ds = (javax.sql.DataSource) ctx.lookup ("myjndi1");
              //Create a connection object
              connection = ds.getConnection();
         The above code is working fine but, the two ht.put statements are creating problem.
    The problem is, after converting the application into WAR file it can be deployed
    on any machine or different port on same machine. My application fails if its deployed on
    weglogicserver which is at different port.
    Is there any way that i can get rid of those ht.put statements or any other way to solve the problem.
    any help is appreciated.
    Thanks in advance
    Pooja.

    Hai All,
    Firstly, thanks for ur reply.
    Even i have seen some code which uses context constructor with out any parameter and works fine.
    i dont understand why its not working for my code.
    When i remove those ht.put code and use context constructor with out any parameter, it giving an error.
    Context ctx = new InitialContext();
    javax.sql.DataSource ds = (javax.sql.DataSource) ctx.lookup ("ocjndi");
    connection = ds.getConnection();The error is as follows:
    javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial
    the above error is forcing me to include those code but if the port number is changed the code will not work. Plz let meknow if some setting have to be made.
    I appreciate all ur valuable help.
    Thanks once again.
    Pooja.

  • Logon Problems? Get support is not working in Portal logon Page

    Hi Experts,
    I have created A Role and assigned Logon_help action to it and assigned the Role to Anonymous group.
    So i have Logon Problem? Get Support link on Portal Logon Screen. When i click on it, i was asked to provide userid and email id.
    I have entered them. i got a message the my userid is reset and sent to my mail. but havent received any mail, and the password is changed which have to log in as admin and reset the password. 
    Help me this regards.
    Thank you
    Siva

    you might not have correctly configured your mail servers....
    refer below link
    http://help.sap.com/saphelp_nw70/helpdata/en/89/c5fd430b63c74bbdfaa5f2ec9bb20b/content.htm
    http://help.sap.com/saphelp_nw70/helpdata/en/44/0761cea5c610b3e10000000a11466f/frameset.htm

  • Anyone know when Apple will bring out a patch to fix the volume problem you get on mac mini after downloading OS 10.8.5

    Anyone know when Apple will bring out a patch to fix the volume problem you get on mac mini after downloading OS 10.8.5?

    Only Apple knows the answer to whether or not there is a verified problem and if so when will a fix be released.  As is their custom, Apple does not talk about these things and the rules of these communities prohibit speculation about future udates or upgrades. It is probably safe to say if a fix is deemed necessary it will be called OS X 10.8.6.

  • Just moved my email from entourage to Mail. Having real problems with getting my signatures to work properly. When adding in a small company logo, windows computers only receive signature as an attachment. Am sending email as Rich Text. Any ideas on a fix

    Just moved my email from Entourage to Mail. Having real problems with getting my signatures to work properly despite sending email as Rich Text.
    When adding in a small company logo to the signature, PC's / windows computers only receive signature and logo as attachments.
    I've tried all possible fixes I can find including getting a PC user to format the logo but no joy. Has anyone experienced this and any ideas on a fix gratefully received.

    Send it as html so the signature is an image source URL

  • Ordering of objects by more than one field and get counts

    i have an object visit (personid, city, street, place, date)
    A person could have visited a same place in the same strret in the same city several times on different dates.
    I have a visits 'Set' for a person and I have to get a count of visits he has done to a place..
    its basically select count(visits) group by city, street , place.
    I know to use interface comparator for a single field.. how to compare multiple fields and get counts??
    if you know abt where i can find information please let me know.
    Thanks.

    For multiple fields, your comparator compares the most significant field first. If they're unequal, it returns +/- accordingly. If they're equal, then it moves on to the next field. And so on, until, finally, if all the relevant fields are equal, then the objects are equal.
    Just like what you do when comparing, say, last names. If the first letters are unequal, you're done, else move onto the next letter, and so on..
    For the count, you wouldn't use a comparator, as that's for sorting. Exactly how you do it depends on the details of what you're storing and how, which you haven't provided.

  • Problem in getting parameter value from selection screen in web dynpro abap

    Hi,
    I am facing problem in getting parameter value from selection screen.
    Please find my code below:
    DATA LT_PAR_ITEM TYPE IF_WD_SELECT_OPTIONS=>TT_SELECTION_SCREEN_ITEM.
    FIELD-SYMBOLS:<FS_PAR_ITEM> LIKE LINE OF LT_PAR_ITEM,
                                 <FS_OBJ_USAGE>    TYPE REF TO data.
      WD_THIS->M_HANDLER->GET_PARAMETER_FIELDS( IMPORTING ET_FIELDS = LT_PAR_ITEM ).
      LOOP AT LT_PAR_ITEM ASSIGNING <FS_PAR_ITEM>.
        CASE <FS_PAR_ITEM>-M_ID.
          WHEN `OBJ_USAGE`.
             ASSIGN <FS_PAR_ITEM>-M_VALUE->* TO <FS_OBJ_USAGE>.      
    [ Here, sy-subrc is 4,  <FS_OBJ_USAGE> is not assigning.]
        ENDCASE.
      ENDLOOP. 
    So, can any one solve this problem.
    Thanks in advance,
    Radhika

    Hi Radhika,
    Try using GET_RANGE_TABLE_OF_SEL_FIELD...
    Please Refer below code..
       DATA: NODE_FLIGHTS TYPE REF TO IF_WD_CONTEXT_NODE.
      DATA: RT_CARRID TYPE REF TO DATA.
      DATA: ISFLIGHT TYPE TABLE OF SFLIGHT.
      DATA: WSFLIGHT TYPE SFLIGHT.
      FIELD-SYMBOLS: <FS_CARRID> TYPE TABLE.
    Retrieve the data from the select option
      RT_CARRID = WD_THIS->M_HANDLER->GET_RANGE_TABLE_OF_SEL_FIELD( I_ID = 'S_CARR_ID' ).
    Assign it to a field symbol
      ASSIGN RT_CARRID->* TO <FS_CARRID>.
      CLEAR ISFLIGHT. REFRESH ISFLIGHT.
      SELECT * INTO CORRESPONDING FIELDS OF TABLE ISFLIGHT FROM SFLIGHT
                           WHERE CARRID IN <FS_CARRID>.
      NODE_FLIGHTS = WD_CONTEXT->GET_CHILD_NODE( NAME = `FLIGHTS` ).
      NODE_FLIGHTS->BIND_ELEMENTS( ISFLIGHT ).
    Thanks,
    Regards,
    Kiran

  • My dvd player will not let me change regions, it just quits when i do, now its stuck on region 1. Any thoughts how i can solve this problem or get round it in some way?

    My dvd player will not let me change regions, it says i have one more chance to change it, then it just quits when i do, now its stuck on region 1. Any thoughts how i can solve this problem or get round it in some way?

    Usually if you have some kind of hardware failure there is some beeping during POST or most motherboards now have LED indicators to produce and error message based on the type of failure
    So if its bad memory, not place properly, mismatched, processor not inserted properly, mismatched voltage or voltage connector not present etc it beeps or generates the error id.
    Power supplies can be tested for failure. There are some walk throughs for testing just them with a switch, paperclip or a jumper (I'd suggest not doing this if you are not familiar with the dangers of electricity).
    Memory can be tested with memory diagnostics programs like Memtest+
    Processors can overheat if the proper precautions have not been taken usually you will get a POST beep or error code for that.
    If the motherboard has no response then do the basics first:
    Check power connectors and power supply. Once you determine that is not the case move on to other items like graphics cards in all the way or memory.

  • If I report a problem and get a "you can't get

    If I report a problem and get a "you can't get your money back", is that the end or has the matter been sent to support for a look?
    What I did:
    I have family share and I found Xcom there with the cloud download symbol, I tapped it and it said "you can't download this", about how specific it was. I tapped it again and it started downloading, never asked for password (to my memory). Later I get an email stating that I had been charged for the game. I submitted a problem and got a fast response, "you can't get your money back". Now, is that it? Or has the matter been forwarded to Apple? If I am not happy, and it hasn't been forwarded where do I turn?

    It's Apple who told you no. That's it unless you want to try calling Apple Care.

  • Problem in Segment count

    Hi guys,
    I have a problem with segment count.
    I.e. I want to count the customer , on the RESPONSE fact table, with a response by MAIL channel and response date >03/11/2009.
    On the segmentation module i create a segment:
    start with RESPONSE_METOD='EMAIL' (count 107 customer)
    Keep RESPONSE DATE > 03/11/2009 ( count 12 customer)
    TOTAL COUNT OF SEGMENT 12 customer. It's wrong because the correct answer is 7 customer.
    instead
    if i create a single "level of segmentation", as follow, it's work:
    Start with RESPONSE_METOD='EMAIL' and RESPONSE DATE > 03/11/2009 (TOTAL COUNT 7 customer)
    How is possible? I try to generate log file to look query but i receive the error "no log found" ( in rpd file i set log level at 2 for the user)
    Best reguards for some suggestion
    Bye

    Hello User -
    Try setting the log level = 7 for the user in the RPD, then save the RPD, clear cache in both RPD and presentation services, and re-run the request. This should allow you access to see the log in "Settings > Administration > Manage Sessions".
    Once you do this, maybe you can paste the log in your next post and we can better attack the issue?
    I hope this helps, and please give points if you found this useful!
    Regards,
    Jason

Maybe you are looking for