Other methods of writing such SQL

Hi All,
Oracle 11g r2 version:
I tried to generate alphabet sequence like A-Z followed by AA-ZZ followed by AAA-ZZZ etc... using this query.
Can anybody suggest any other ways to do it in terms of BETTER performance.
WITH chrset AS
        (    SELECT CHR (ASCII ('A') + ROWNUM - 1) alph
               FROM DUAL
         CONNECT BY ROWNUM <= 26),
     t AS
        (SELECT alph FROM chrset
         UNION ALL
         SELECT a.alph || b.alph
           FROM chrset a, chrset b
         UNION ALL
         SELECT a.alph || b.alph || c.alph
           FROM chrset a, chrset b, chrset c
         UNION ALL
         SELECT a.alph || b.alph || c.alph || d.alph
           FROM chrset a,
                chrset b,
                chrset c,
                chrset d
         UNION ALL
         SELECT a.alph || b.alph || c.alph || d.alph || e.alph
           FROM chrset a,
                chrset b,
                chrset c,
                chrset d,
                chrset e),
     basetbl AS (SELECT ROWNUM r, alph FROM t)
SELECT r id, alph nm
  FROM basetbl
WHERE r <= 100;Cheers,
Manik.
Edited by: Manik on Mar 8, 2013 11:43 AM

select case when rownum <= 26 then chr (64 + rownum )
            when rownum <= 26*26 then
                 chr (64 + floor((rownum-1)/26) ) ||
                 chr (64 + decode(mod(rownum,26),0,26,mod(rownum,26)) )
       end  alph
from dual
connect by rownum <= 100;You can add to CASE if more than 26*26 is required..
Edited by: jeneesh on Mar 8, 2013 12:02 PM
Definitely more options are there - MODEL, RECURSION (With WITH clause).. You can try yourself and come back if you face any issues..

Similar Messages

  • Help required in writing an sql to fetch the the difference of the data.

    Hi Gurus,
    Could some one help me in writing an sql to pull data the difference between two same structured tables from two different database and to store that data in an temperory table.
    many many thanks in advance

    Lets say you have two db SOURCE and DEST
    SOURCE is the DB that you have Logged in into. Now you do the following.
    1. Createa DBLink to DEST database.
    2. Check if the DBLink works properly.
    3. Then execute the following sql.
    select <column_list> from <table_name>
    minus
    select <column_list> from <table_name>@<dblink>
    union all
    select <column_list> from <table_name>@<dblink>
    minus
    select <column_list> from <table_name>

  • EJB 3.1 @Asynchronous and calling other methods from within

    Hey all,
    I am helping a friend set up a test framework, and I've turned him on to using JEE6 for the task. I am decently familiar with entity beans, session beans, and such. One of the new features is @Asynchronous, allowing a method to be ran on a separate thread. The test framework generally needs to spawn potentially 1000's of threads to simulate multiple users at once. Originally I was doing this using the Executor classes, but I've since learned that for some reason, spawning your own threads within a JEE container is "not allowed" or bad to do. I honestly don't quite know why this is.. from what I've read the main concern is that the container maintains threads and your own threads could mess up the container somehow. I can only guess that this might be possible if your threads use the container services in some way.. but if anyone could enlighten me on the details as to why this is bad, that would be great.
    None the less, EJB 3.1 adds the async capability and I am now looking to use this. From my servlet I use @EJB to access the session bean, and call an async method. My servlet returns right away as it should. From the async method I do some work and using an entity bean store results, so I don't need to return a Future object. In fact, my ejb then makes an HttpClient call to another servlet to notify it that the result is ready.
    My main question though, is if it's ok to call other methods from the async method that are not declared @Asynchronous. I presume it is ok, as the @Asynchronous just enables the container to spawn a thread to execute that method in. But I can't dig up any limitations on the code within an async method.. whether or not it has restrictions on the container services, is there anything wrong with using HttpClient to make a request from the method.. and making calls to helper methods within the bean that are not async.
    Thanks.

    851827 wrote:
    Hey all,.. from what I've read the main concern is that the container maintains threads and your own threads could mess up the container somehow. I can only guess that this might be possible if your threads use the container services in some way.. but if anyone could enlighten me on the details as to why this is bad, that would be great.
    Yes since the EE spec delegated thread management to conatiners, the container might assume that some info is available in the thread context that you may not have made available to your threads.
    Also threading is a technical implementation detail and the drive with the EE spec is that you should concentrate on business requirements and let the container do the plumbing part.
    If you were managing your own threads spawned from EJBs, you'd have to be managing your EJBs' lifecycle as well. This would just add to more plumbing code by the developer and typically requires writting platform specific routines which the containers already do anyway.
    >
    None the less, EJB 3.1 adds the async capability and I am now looking to use this. From my servlet I use @EJB to access the session bean, and call an async method. My servlet returns right away as it should. From the async method I do some work and using an entity bean store results, so I don't need to return a Future object. In fact, my ejb then makes an HttpClient call to another servlet to notify it that the result is ready.
    My main question though, is if it's ok to call other methods from the async method that are not declared @Asynchronous. I presume it is ok, as the @Asynchronous just enables the container to spawn a thread to execute that method in. But I can't dig up any limitations on the code within an async method.. whether or not it has restrictions on the container services, is there anything wrong with using HttpClient to make a request from the method.. and making calls to helper methods within the bean that are not async.
    Thanks.If you want to be asynchronous without caring about a return value then just use MDBs.
    The async methods have no restrictions on container services and there is nothing wrong with calling other non async methods. Once the async method is reached those annotations don't matter anyway (unless if you call thhose methods from a new reference of the EJB that you look up) as they only make sense in a client context.
    Why do you need to make the call to the servlet from the EJB? Makes it difficult to know who is the client here. Better use the Future objects and let the initial caller delegate to the other client components as needed.

  • Help required in writing an sql querry

    Hi guys,
    Could any one hlep me out in writing an sql querry for the below requirement.
    the requirement is: for a perticular ID if we have different names then we need to get it out as multiple else the name itselef. I have given the sample input and the expected output.
    ID Name
    1 A
    1 B
    2 F
    2 F
    3 C
    4 D
    4 E
    Out put should look like
    ID Name
    1 Multiple
    2 F
    3 C
    4 Multiple
    Thanks in advance
    Shylender.
    Edited by: 959345 on Nov 22, 2012 10:13 PM

    May be this:
    WITH t AS
            (SELECT 1 id, 'A' str FROM DUAL
             UNION ALL
             SELECT 1, 'B' FROM DUAL
             UNION ALL
             SELECT 2, 'F' FROM DUAL
             UNION ALL
             SELECT 2, 'F' FROM DUAL
             UNION ALL
             SELECT 3, 'C' FROM DUAL
             UNION ALL
             SELECT 4, 'D' FROM DUAL
             UNION ALL
             SELECT 4, 'E' FROM DUAL),
         t1 AS
            (SELECT id,
                    CASE
                       WHEN COUNT (DISTINCT str) OVER (PARTITION BY id) > 1 THEN
                          'MULTIPLE'
                       ELSE
                          str
                    END
                       str
               FROM t)
      SELECT id, str
        FROM t1
    GROUP BY id, str
    ORDER BY 1;Cheers,
    Manik.

  • Please help me in writing the SQL

    Hi,
    I am new to oracle.. Can you please help me in writing a SQL
    I have a table which has the following columns
    Start_date m1 ---- Start month of each quarter (Jan,Apr,Jul,oct)
    end_date m3---- End month of each quarter
    m1_start_date,
    m1_end_date,
    m2_start_date,
    m2_end_date,
    m3_start_date,
    m3_end_date,
    M1_act_rev,
    m2_act_rev,
    m3_act_rev
    If a user selects the dates from Jan,2011 to Jun, 2011
    I should get the aggregate of the revenues (m1+m2+m3+m1+m2+m3)

    Hi Gurus,
    Will this work
    select
    b.DISTRICT_NAME,
    count(c.CONTRACT_NUMBER),
    sum(C.M1_ACT_REV),
    sum(C.M2_ACT_REV),
    sum(C.M3_ACT_REV),
    sum(C.M1_EXP_PRICE),
    sum(C.M2_EXP_PRICE),
    sum(C.M3_EXP_PRICE)
    from
    clm_mn_compliance_data c,
    CLM_MN_CUSTOMER_ALIGNMENT_DATA b
    where
    ((m1_start_date between '01-01-2011' and '03-31-2011' ) and (m1_end_date between '01-01-2011' and '03-31-2011')) or
    ((m2_start_date between '01-01-2011' and '03-31-2011' ) and (m3_end_date between '01-01-2011' and '03-31-2011')) or
    ((m3_start_date between '01-01-2011' and '03-31-2011' ) and (m3_end_date between '01-01-2011' and '03-31-2011')) and
    b.CUSTOMER_ID = C.CUST_CTRT_ID
    group by
    B.DISTRICT_NAME;

  • What is the best method for writing Multicolum​n List data to a text file?

    I am trying to find the best method for writing the data from a multicolumn list to a text file. Say the list has 7 rows and 6 columns of data. I would like the final file to have the data resemble the Multicolumn List as closely as possible with or without column headers. A sample VI showing how to accomplish this would be greatly appreciated. I realize this is pretty basic stuff, but I can get the output to the file, but it comes out with duplicate data and I am on a time crunch hense my request for help.
    Thank You,
    Charlie
    Everything is Free! Until you have to pay for it.

    Hello,
    I think that the answer to your question it's on the example that I've made right now.
    See the attached files....
    Software developer
    www.mcm-electronics.com
    PS: Don't forget to rate a good anwser ; )
    Currently using Labview 2011
    PORTUGAL
    Attachments:
    Multi.vi ‏12 KB
    Multi.PNG ‏6 KB

  • Recursive Java programming method for executing recursive SQL queries

    Anybody has a Java/JDBC example method to execute recursive SQL queries and print results? The method has to work for any number of queries and levels and the first query passes the parameter to the second query.
    Edited by: user4316962 on Jun 12, 2011 1:59 PM

    user4316962 wrote:
    Guys, the problem what I am trying to solve is much more complex and I don’t think SQL level recursion is enough. I am looking for Java solution with SQL queries in it to make it more flexible and DB independent.
    If you want to do recursion in SQL then it has nothing to do with Java.
    And if you want to do recursion in Java then the idiom itself has nothing to do with SQL.
    Other than that you have provided enough detail for anyone to even guess at what you are asking.
    As a start I am not even sure that you understand what recursion is nor how JDBC works. (But it could be that you are using the terms to mean something else.)
    And looking at your original post it could be nothing more than that you are looking for a design pattern - perhaps the interpreter.

  • Pm-suspend resumes from suspend, but all other methods don't

    Running Arch with xfce. Everything is updated and am on kernal 3.9. Desktop PC, motherboard Gigabyte H61N-USB3 (latest BIOS).
    I've been having an issue for a few months with resume not working properly after a suspend. I've tried all sorts of solutions, e.g.:
    adding items to my kernal line (hpet=disable, acpi_osi=Linux)
    installing acpi, acpid
    disabling HPET in the BIOS
    editing /etc/mkinitcpio.conf with the resume hook instead of autodetect
    installing uswsusp
    None worked. Seen a lot of threads here of people having the same issue, but with me, it ALWAYS resumes fine if I suspended with pm-suspend.
    If I issue pm-suspend, the computer suspends nicely. I press the power button and everything comes back on. /var/log/pm-suspend.log is always successful.
    But, if I use any other method, such as sysctl suspend, or upower, or the suspend option in the Xfce menu (uses xfce4-power-manager), the resume doesn't wake any USB devices (my mouse light stays off) or the monitor (stays in blinking stanby mode). Sometimes it will resume fine, very rarely, but 90% of the time it won't. Only the PC power light will come on but that's it. Even the reset button won't restart the PC. I have to hold the power button for 4 seconds to turn it off.
    I'm almost to the point of replacing the motherboard over this as it's driving me up the wall.
    pm-suspend (which works great) generates a pm-suspend log. But any of the other methods generate a pm-powersave log. So those other methods must have something in common. I will post the contents later as I'm at work.
    I'd like to get the other methods working because if the PC suspends after a set time (through xfce), or if I use the Xfce suspend menu option, I know it won't resume. A workaround would be to make a pm-suspend menu option and some sort of schedule for it to run after a certain idle time, but that's not an answer for the original problem.
    Is there any way I can troubleshoot why systemd and other methods don't resume but pm-suspend does resume it fine?
    Last edited by nLinked (2013-05-24 13:52:20)

    I cleared pm-powersave.log and suspended through the xfce menu > Suspend.
    Resume worked fine once.
    Suspended again.
    Resume worked fine second.
    Suspended again, resume didn't work, PC fans on but mouse and display off.
    The output of the new pm-suspend.log is here, although it's possible it can't write any errors to the log when resume fails?
    http://pastebin.com/ZHDSeG6H

  • What other methods are there to re-install Win 8.1 pro without losing files & programs, if I am unable to update my Recovery image?

    So I am thinking my Windows 8.1 Pro needs a refresh, but I have not ran "recimg /createimage C:\*" for a while and because of the problems I have. I cannot create a new one, it just wont work and I've had a post on here about that issue for a while
    now and nothing has worked.  So I know I need to re-install windows but I really want to be able to keep my Programs & files.
    So my question is, are there any other methods to re-install Windows 8.1 pro without losing my programs?
    That's the reason I have not just done a reinstall, because of the time and effort needed to do this in a timely manner.  Also I need to keep my programs APPDATA intact so that my applications still work as they do now, some programs have got months
    of history and data.  Also I am not certain I still have the installers for some of my applications, I know I can get them but again its the time it would take.
    This is why I run a separate backup of my APPDATA DIR, am I right in thinking that If I did have to reinstall that I could just restore the old APPDATA data to the new Install and my programs would automatically have all there normal settings?
    So what are my options?
    Thanks peeps.
    JK MCP

    Isn't that only used when a PC will not boot?
    What options does booting with this give me?
    Thanks
    JK MCP
    Hi,
    USB recovery disk was used to recover your system when it encounter problem. You can try to use it to fix your problem instead reinstall system. However, there is no method to keep your program whenreinstall system.
    Roger Lu
    TechNet Community Support

  • Can i use other application on ipad such as microsoft excel or word? how?

    can i use other application on ipad such as microsoft excel or word? how?

    'Normal' PC and Mac (OS X) software do not work on the iPad (iOS), they are different operating systems. You can only install apps from the iTunes App Store on your computer or the App Store app directly on your iPad.
    Numbers (http://itunes.apple.com/us/app/numbers/id361304891?mt=8) and Pages (http://itunes.apple.com/us/app/pages/id361309726?mt=8) are two options, as are third-party apps such as Documents To Go :
    'normal' version : http://itunes.apple.com/us/app/documents-to-go-office-suite/id317117961?mt=8
    premium version : http://itunes.apple.com/us/app/documents-to-go-premium-office/id317107309?mt=8

  • Is there any other method so that I can contact Apple to get IMEI number ? since the phone was shyncronized several times in apple store / iCloud.

    Hello community members, my iPhone has been stolen and I tried to contact police, they are asking for IMEI number of the phone. Unfortunately I could not read the IMEI number on the box due to moisture wiped out most of the number on it. I sacanned it in and enhanced, I'm still unable to read out the number. Is there any other method so that I can contact Apple to get IMEI number ? since the phone was shyncronized several times in apple store / iCloud.

    If you backed up your iPhone in iTunes on your computer -
    Open iTunes - Edit - Preferences - Devices - See Device Backups in the Window.
    Hover mouse/curser on any backup. Read IMEI and Serial no. your of iPhone.

  • Is there any other method other than se78 to upload a graphic into SAP R/3?

    Hi,
      Is there any other method other than se78 to upload a graphic into SAP R/3?
    Anita Jeyan

    hi ,
    just use  OAER or RSTXLDMC program
    it will definately help you
    regards
    rahul

  • File adapter Need to wait When Other Applicatio is writing the file

    Hi All,
    This is File to File Interface, iam using NFS here.
    While other application is writing the file to the Folder, XI Sender File Adapter shld wait for certain time and then pick it up.
    We have the Option " MSecs to Wait Before Modification Check" on File Sender Advanced TAB.
    But it is no Use, it is not behaving correctly.
    Please assist me on this
    Regards

    Hey Vamsi,
    I think you're good to go here. The behaviour is exactly as it should be. The polling interval takes priority when there is no file there but when there is a file there the modification check will take priority over polling interval so it will still wait the mandatory 2 minutes to ensure that no modification is taking place & that's exactly what you want. You don't want to pick up an incomplete file irrespective of when it was put there. So there will always be just over a 2 minute delay (or whatever you set the Msecs value to + a few seconds depending on where the polling cycle is when a file is written out but a max of 2 minutes & 19 seconds delay) when there is a file there but at least you'll have consistent data. If there is no file there the adapter will just poll every 20 seconds until a file arrives.
    The 2 minute 'wait' step is exactly that. The adapter will see the file then wait 2 minutes & probably does a timestamp comparison or something. It doesn't do a modification check within those 2 minutes. Having said that, I don't see why you can't reduce the Msecs interval. My reasoning is that you basically want to establish whether it's still being wriiten out before you pick it up. Even if you set it to 5 seconds you should still be able to pickup whether the file is being modified (I'm assuming that the check is doing a timestamp comparison). That will significantly reduce your time wait period.
    My assumption on the timestamp comparison was wrong It's actually does a comparison on file size when it reads the data in, see SAP Note (Point 3): [http://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/oss_notes/sdn_oss_bc_xi/~form/handler%7b5f4150503d3030323030363832353030303030303031393732265f4556454e543d444953504c4159265f4e4e554d3d383231323637%7d]
    Another suggestion made on the note: Get the writing application to write the file out with an extension different to the one you're polling for. Then, after they have completed writing out the file, they can do a re-name to the extension that you're polling for. That could also speed up things.
    Regards, Trevor
    Edited by: Trevor Naidoo on Oct 8, 2009 9:38 AM

  • I dont know what to do!!! I pulled out my headphones and then saw that my sound was not working correctly. I was horrified to find a piece of the headphone never came out. I have heard how much it costs to repair and the other methods are not working.

    Please help, i am so scared that i will never get my laptop back the way it was.

    "the other methods aren't working"
    Well, what other methods have you tried that didn't work?  Frankly, your post reads as a hoax, but I have some extra time on my hands, and an idea.  Make an appointment with the Apple Genius at your local Apple store.  You could also bring your MBP to an AASP.  Regardless, either one should be able to remove the bottom cover, and use a plastic thingy (dang, what is that tool called?) to push out the offending bit.

  • Hello sir i purchase second hand iphone4s now my iphone ask for activation with id and password i contact with previous owner and use that id and password but that also not work what i do ola help me i try all other method restore ' upgrade

    hello sir i purchase second hand iphone4s now my iphone ask for activation with id and password i contact with previous owner and use that id and password but that also not work what i do ola help me i try all other method restore ' upgrade etc but none work plz say what i do if u find some solution tham msg me on
    iPhone 4S

    oenkz33 wrote:
    this does not help at all for the second owner, after making the first owner id with careless, sorry for my english ...
    Careless? Possible, but unlikely. Most likely the phone was stolen from the first owner. It would be a VERY careless iPhone owner who did not erase their personal information from a phone before selling it, and to do that it is necessary to disable Activation Lock. In most places in the world knowingly using stolen property is a crime, so the fact that the phone doesn't work may be the least of one's risks.

Maybe you are looking for

  • PS CS5 workaround to non compliant Shader3.x/OpenGL 2.0 video cards

    Stumbled upon a possible workaround for those who want to use some of the latest CS5 PhotoShop enhancements such as 3D effects and Repoussee which is worth sharing.  Background.... home workstation is a i7-920 Windows 7 Ultimate 64-bit o/s with modes

  • My quick menu worked for a week than quit working. i reinstalled everything and same thing, it work

    my quick menu worked for a week than quit working. i reinstalled everything and same thing, it work ed for a few days than quit working. it says it is not a compatable program. i have win8. now it wont even work when i reinstall.

  • RFC Connection IPC Data Loader R/3 failed

    I want to setup a Internet Sales (R/3 Edition) scenario. In documentation "Installation Guide SAP IPC 4.0 Server (Version 2.17)" 6.3.2 Defining RFC Destination the test of the connection doesn't work (Service Data Loader is running). The following er

  • Capture /dev/dsp?

    This is more of a curiosity than a problem, but anyway. I have a Qosmio X300 notebook based on ICH9 chipset with Intel HDA odboard audio. It is a pretty crappy chip and I'd like to capture it's output. (the "what U hear" thingy). I've googled a bit a

  • SCCM 2012 R2 MBAM Integration

    Hey there, I'm having a bit of trouble importing the SMS_Def.Mof file as per these instructions https://technet.microsoft.com/en-us/library/dn656927.aspx Whenever I attempt to import them to the Default Client Settings Hardware Inventory i get the fo