How Level Cause Works?

I tried to figure out how "connect by level" clause works, but I am not able to come up how it works.
As a try-out, I created a table with 3 column "from_date" date type, "to_date" date type and "user_name" varchar type.
It has 2 rows:
  FROM_DATE   TO_DATE     USER_NAME
  15-OCT-09   18-OCT-09   thomas
  25-OCT-09   30-OCT-09   janeUpon executing the following SQL:
  select distinct level - 1 + from_dt "Day", user_name
  from my_table
  connect by level < (to_date - from_date + 1)
  order by user_name;
     LEVEL DAY       USER_NAME
         1 25-OCT-09 jane
         2 26-OCT-09 jane
         3 27-OCT-09 jane
         4 28-OCT-09 jane
         5 29-OCT-09 jane
         1 15-OCT-09 thomas
         2 16-OCT-09 thomas
         3 17-OCT-09 thomas
[This is exact presentation that I am looking for]But, if DISTINCT is ommitted, query returns many rows as follows:
     LEVEL DAY       USER_NAME
         5 29-OCT-09 jane
         4 28-OCT-09 jane
         3 27-OCT-09 jane
         5 29-OCT-09 jane
         4 28-OCT-09 jane
         2 26-OCT-09 jane
         5 29-OCT-09 jane
         4 28-OCT-09 jane
         5 29-OCT-09 jane
         3 27-OCT-09 jane
         4 28-OCT-09 jane
         5 29-OCT-09 jane
         2 26-OCT-09 jane
         4 28-OCT-09 jane
         5 29-OCT-09 jane
         3 27-OCT-09 jane
         4 28-OCT-09 jane
         5 29-OCT-09 jane
         1 25-OCT-09 jane
         4 28-OCT-09 jane
         5 29-OCT-09 jane
         3 27-OCT-09 jane
         4 28-OCT-09 jane
         2 16-OCT-09 thomas
         3 17-OCT-09 thomas
         3 17-OCT-09 thomas
         3 17-OCT-09 thomas
         3 17-OCT-09 thomas
         2 16-OCT-09 thomas
         1 15-OCT-09 thomasSo, how do I eliminate duplicacies in level column within same
user_name without using DISTINCT (as it requiers sorting).
And my production db has many many rows the table that I have to work on and my application invokes
this query many times. So, its unimaginable for me think of resource usage by way of using DISTINCT.
Does any expert have a workaround for this? I'd like to eliminate GROUP BY, DISTINCT clause and use
and alternative light-weight clasue instead.
Regards,
...

Do you know that there's a specific forum for this kind of questions?
PL/SQL
Werner

Similar Messages

  • How Transaction Manager work with Resource Manager, like Connection pool?

    hi,
    I'm using BEA Webloigc8.1 Stateless Session Bean/DAO/Oracle stored proc.
    but I'm not quite clear how Transaction Manager work with Resource Manager, like Connection pool.
    my understanding is that, in a weblogic transaction, a stateless session bean interact with several DAOs, and for each method of DAO a connection is acquired from connection pool. I've heard that the connection will not return to pool until the transaction commits.
    My question is that, does it mean that for a weblogic transaction, multiple connections might be allocated to it? and if multiple connections are allocated, then how many oracle transactions would be started? or multiple connections share the same oracle transaction?
    I didn't feel it make sense to start multiple oracle transactions, cause deadlock might be incurred in a single weblogic transaction.
    any help appreciated!

    Xin Zhuang wrote:
    hi,
    I'm using BEA Webloigc8.1 Stateless Session Bean/DAO/Oracle stored proc.
    but I'm not quite clear how Transaction Manager work with Resource Manager, like Connection pool.
    my understanding is that, in a weblogic transaction, a stateless session bean interact with several DAOs, and for each method of DAO a connection is acquired from connection pool. I've heard that the connection will not return to pool until the transaction commits.
    My question is that, does it mean that for a weblogic transaction, multiple connections might be allocated to it? and if multiple connections are allocated, then how many oracle transactions would be started? or multiple connections share the same oracle transaction?
    I didn't feel it make sense to start multiple oracle transactions, cause deadlock might be incurred in a single weblogic transaction.
    any help appreciated!Hi. If you configure your WLS DataSource to use keep a connection for
    the duration of a tx, it will do that, and in any case there can be
    no deadlock however many connections operate for a given XA transaction.
    Here is the best coding form for DAOs or any other user-written code
    for using WebLogic DataSources. This is important for two reasons:
    1 - Thread-safety is maintained as long as the connection is a
    method-level object.
    2 - It is crucial to notify WebLogic that you are done with a connection
    ASAP, by your calling close() on it. We will then put it back in the
    pool, or keep it under the covers for your next request if it's in a
    transaction etc. The pool is optimized for quick get-use-close scenarios.
    public void one_of_my_main_JDBC_Methods()
    Connection con=null; // Must be a method level object for thread-safety
    // It will be closed by the end of the method.
    try {
    con = myDataSource.getConnection(); // Get the connection in the try
    // block, directly from the WebLogic
    // datasource
    // do all the JDBC within this try block. You can pass the
    // connection to subordinate methods, but not to anywhere
    // that thinks it can use the connection later.
    rs.close(); // close any result set asap
    stmt.close(); // then close any statement asap
    // When you're done with JDBC
    con.close(); // close the connection asap
    con = null; // nullify it so the finally knows it's done
    catch (Exception e) {
    // do whatever catch stuff you want. You don't
    // need a catch block if you don't want one...
    finally {
    // It is important to close a JDBC connection ASAP when it's not needed.
    // without fail, and regardless of exit path. Do everything in your
    // finally block in it's own try-catch-ignore so everything is done.
    try { if (con != null) con.close();} catch (Exception ignore){}
    return ret;
    }

  • Hey i am unfamiliar with how to use icloud for storage. Can some one slowly( lol ) help me to understand how this thing works. I also need someone to help with how to transfer pics from your iphone to your flash drive.

    Hello i am needing some assistance as i am not very good at how the cloud works. I need to delete my account and start over.  I don't want to loose all of the things that i have on phone. Help!

    Slowly
    http://www.apple.com/icloud/features/
    but surely
    http://www.gottabemobile.com/2011/10/18/how-to-sync-email-contacts-and-calendar- with-icloud/
    we will come
    http://transfer-iphone-contacts.blogspot.com/p/iphone-contacts-sync-via-icloud.h tml
    to understanding
    http://support.apple.com/kb/PH12519
    on how icloud sync and backup work.
    http://www.apple.com/support/icloud/backup/
    http://support.apple.com/kb/ht1766
    And here we will find instructions on how to backup (import) pictures to computer, cause there is no direct transfer to flash drive.
    http://support.apple.com/kb/ht4083

  • APO DP with MRP How does it work.?

    Hi Gurus,
                 I just wanted to know how the process works with APO DP implementation with MRP?
    Please let me know if you have documents available. It will be really great help
    Thanks a lot
    Regards,
    Raj

    Hi Raj,
       Demand Planning tool is basically meant for generation of Future demand at different planning level with the help of Characteristcis Value combination.
       For generation of future demand you need past sales history which you can take from R/3 with the help of BW functionality.
       After that you run forecast engine & generate future demand. Now for taking planning run & generation for PIR or Perchase requistion you need this demand. Here you are using MRP for taking planing run.
    So first you have to transfer demand which is unconstrained in to R/3 in MD61 with the help of transaction /SAPAPO/REL_TO_OLTP - Release from InfoProvider to ERP System but you need to take backup of your DP planning area & save data in to info cube.
        After that you can transfer data from Info Cube to R/3 with the help of above transaction. In R/3,after MRP run you can find Planned Order & Purchase Requistion. After that you have convert that in to Production Order & purchase order as per your requirement.
       But MRP having some restriction like MRP & Capacity planning will not run simulteniously etc. so generally we are prefer SNP tool for genetarion of these data with accuracy & optimized.
    Hope this will help you.
    Regards
    Sujay

  • ORACLETEXTSEARCH - How Does it work?

    Hi experts,
    I had a many disccusions with my coleagues about ORACLETEXTSEARCH in the UCM11g. We found that we don't undestrand How does it work.
    I have a basic questions:
    1. Does ORACLETEXTSEARCH use only database engine for the indexing?
    2. Can I start fulltext indexing without Oracle UCM? Only by database.
    3. Are some differences between UCM10g and 11g?
    Thank you for the answers and the explanation.
    Martin

    1. Oracle text is a DB tool installed at the DB level, however as others say the triggers to kick it off are done by UCM not independently at the DB. I do not think it could work that way.
    2. No, but other indexing options are available like SES
    3. 10g required a component to be added to the UCM server and required an 11.1.0.7.0 or greater oracle DB. 11g requires no extra component but still has the db requirement.
    SES can be configured to index multiple different repositories (including UCM) and you can control the index rebuilds directly from SES as an option for number 2.

  • 0BALANCE logic ,how does it work

    Gurus,
    in 0FIGL_C10 we have the key figure 0BALANCE ,can any one explain how does it work .
    it has properties
    aggregation ="SUM"
    Exception aggregation ="LAST VALUE"
    Agg.Reference Char = "0FISCPER"
    said that
    if we have 3 records coming from ECC below ,what is the value stored in the infocube as all of the values are coming on same period 05/2009.
    Gl account   Amount     period
    123               1000 $     05/2009
    456               2000$      05/2009
    789               3000 $     05/2009
    thanks in advance

    Zuben,
    There are three records in your case it might be for three differnent char at detail level for example
    Period1    Cost center1    GL A/C1      KF1
    Period1    Cost center2    GL A/C1      KF1
    Period1    Cost center3    GL A/C1      KF1
    In this case 0 Balance will be for each cost center. If in next month there is no data for Cost center2 then next period the 0balance for costcenter2 will be same as previous period.
    It depends on what is the lowest level of details you have in cube for same period/account etc.
    if in other case for example you do not have cost center in your cube than the data for Period 1 will be
    Period1 GL A/C1 KF1KF2KF3
    Please let us know if you have further questions.
    Regrads,
    Kams

  • Openning a Link from MS Office OneNote 2007 launches MS Internet Explorer althoug FireFox is my default Internet browser. Any idea how to cause OneNote 2007 to Launch FireFox instead?

    Openning a Link from MS Office OneNote 2007 launches MS Internet Explorer althoug FireFox is my default Internet browser. Any idea how to cause OneNote 2007 to Launch FireFox instead?

    Below is how it is being done.  This worked perfectly for years. MS Office 2007 does complain that the file extension does not match the data format (it's a tab delimited text file but I'm pretending it's an Excel file so they'll be prompted to view it as a spreadsheet in Excel) but you just click open and it works fine.  This issue with IE is new.  Let me know if you have any more ideas.
    <CFSETTING ENABLECFOUTPUTONLY="Yes" SHOWDEBUGOUTPUT="No">
    <!--- variables used for separating cells with tabs, and for new rows --->
    <CFSET tabchar=chr(9)>
    <CFSET newline=chr(13) & chr(10)>
    <!--- tell browser it's an Excel file --->
    <CFCONTENT TYPE="application/vnd.ms-excel">
    <!--- tell Internet Explorer to open as Excel file --->
    <CFHEADER NAME="Content-Disposition" VALUE="filename=myfile.xls">
    <!--- get data --->
    <CFQUERY NAME="getinfo" DATASOURCE="mydsn">
        select fieldone, fieldtwo
        from mytable
    </CFQUERY>
    <!--- output column headings --->
    <CFOUTPUT><CFLOOP INDEX="q" LIST="fieldone,fieldtwo">#q##tabchar#</CFLOOP>#newline#</CFOUTPUT>
    <!--- output database records --->
    <CFOUTPUT QUERY="getinfo">#getinfo.fieldone##tabchar##getinfo.fieldtwo##newline#</CFOUTPUT>

  • How does it work with an iPad?

    Thinking about buying an Airport for my iPad to boost the wifi signal any know how the Airport works with an iPad? 

    An Airport will not boost a WiFi signal.  Period.
    An Airport can be configured to extend (repeat) a WiFi signal generated by another Airport.  This is done to extend the distance of the WiFi system but it does cause a loss of throughput (because of overhead).
    I wanted to get a WiFi signal out to my back porch.  I turned off the radio on my existing router (Westell) and purchased TWO Airport Express units.  One replaced the Westell radio and the other functions as an extender.  Works like a champ.

  • Capacity Leveling of Work Center

    Hi all,
    I have a problem with Capacity of Work center (WC).
    I have a Internal Activity, and i assigned a WC for this Internal Activity. WC's capacity is 100H/day for 1 number of element.
    Work of this WC is 250H, duration 5 days, number of element 1. Default capacity of this WC is distributed by Distribution Key define in Activity. . And they are divided equally between factory days in 5 day. That is capacity requirement is 50H/Day
    So, i want to edit this WC's capacity following value:
    Day 1: 100H/day
    Day 2: 50H/day
    day 3: 0H/day
    day 4: 0H/day
    day 5: 100H/day
    How can i do it?? I try to use Dispatch Manually but i cant solve this problem.
    Please help me for this case.
    Thank all.
    NLQ

    Dear
    Capacity leveling depends on some of the basic set up of Capacity Requirement Planning .You need to have proper CRP set up frist .
    Couple of check points : -
    Did you work centre is relevent for finitie scheduling in CR02-Capacity Header and wht is the over laod percentage for work centre ?
    Did you have Capacity Requirement Related Set up like Over all profile , time profile , Startegy Profile -OPD0?
    Did your Capacity Check -OPJK -Order Control at order level are active for availibilty Check 1 and 2 and assinged Over all Profile ?
    Set up :
    1.Please assing a operation control key like PP01 where Details Capacity Check and scheduling is active .
    2.In CR02-Work centre -Capacity Header -You should have Follow check box marked
    1.Releven for Finitie Scheduleing
    2.Can be used for multiple Operation
    3.
    3.OPU3/OPU5 -Define Scheduling paramter -Mark Scheduling and Capcity Check for planned order or production Order
    4.In SPRO -Shop Floor Control-Define Production Scheduling Profile -You need to matian the relevent Parameters like
    1.Schedueling Automatically 2.Scheduling Log 3.Adjust Scheduling -Basic date , Depedent Requirement date 4.Scheduling Type -Backward etc .
    These are all basic level set up beside CRP overall profile and other profile like strategy /time etc which may in place as you are analysing in CM01.
    Please find below some of the useful CRP details : Refer this threads which are self explaintory :
    http://help.sap.com/saphelp_47x200/helpdata/en/8a/a5a3154adc11d189740000e8322d00/frameset.htm
    http://www.scribd.com/doc/17026521/SAP-ECC-60-PP-Capacity-Planning-httpsapdocsinfo
    capacity planning
    http://help.sap.com/printdocu/core/print46c/en/data/pdf/PPCRPSFC/PPCRP_SFC.pdf
    Capacity Planning
    capacity requirements planning
    How to dispatch operation to do Capacity Leveling at Work Centre Level :
    1.Frist Check the  over load at work centre . Goto -CM07/CM05-give plant only -then hit the Stnadard view -You will find weekly or daily baiss load ( Requirement , Avaliable Capcity , Overlaod etc )
    2.Check the week in which days you are tring to dipatch -if you selet the week check box and double clik it will show u all the dataiul load .Basde on the available capacity in other week-days u need to dipatch in CM22/CM31  or CM25/CM21
    While dipatching in CM22/CM31-Select the Stragegy button on the top header -Mark Date entry when dispatching  so that when you select the operation of any production order or planned order for certain work centre , it will pop with window having information of Date , Work Centre , Time .Onec you did this you will receive Scheduling log with certain information .
    Hope this helps
    regards
    JH

  • I really can't understand how this recursive works??

    Hi all,
    I have got a recursive function that checks for palendrome string. But it is confusing. I know that a string is palenromme if it is empty or has a char or first char and last one are same and middle is palindromme too.
    but can't understand how this function works.
    class Palindromme
         boolean palindrom(String s)
              if (s.length() <= 1 || s.equals(null) || s=="") //this is the stopping point
                   return true;
              else
              {                    //recursive definition
                   return ( s.charAt(0) == s.charAt(s.length()-1) ) && palindrom(s.substring(1,s.length()-1));
    specially i don't know how palindrom(s.substring(1,s.length()-1)); is working cause it has to be increased for each loop.
    abdul
    PS: actually i don't know how recursion works from Data structure point of view

    Hi,
    ok your palindrome is : "otto"
    return ( s.charAt(0) == s.charAt(s.length()-1) ) && palindrom(s.substring(1,s.length()-1));
                  o                     o                                   tt
    so first part is true                                        
    in the second part palindrom is called again but with the remaining tt
    so second time :
    return ( s.charAt(0) == s.charAt(s.length()-1) ) && palindrom(s.substring(1,s.length()-1));
                   t                     t                                 ""
    Third time:
    if (s.length() <= 1 || s.equals(null) || s=="") //this is the stopping point
    return true;after all for otto the recusion is:
    return ( s.charAt(0) == s.charAt(s.length()-1) ) && s.charAt(1) == s.charAt(s.length()-2) ) && nothing left of otto);
    Phil

  • FAQ: How does GroupPix work?

    FAQ: How does Grouppix work?
    Answer:
    GroupPix is an iPhone app that automatically collects photos taken by you and friends that you invite. It lets you comment on and automatically share photos with others. Everyone participating in a GroupPix group album needs to install and use the GroupPix app. You can download it for free from the App Store. Provided everyone has a good network signal, all the photos -- either taken with the built-in GroupPix camera, or added via the camera roll -- can be shared with everyone else in the group event. Leave comments and vote for favorites to add a fun social angle to the event!
    Related: read the thread about how to invite others to use GroupPix.

    By default, WAAS preserves the DSCP marking on intercepted packets.  There is a configuration option to set/override the DSCP value at the global (device), application, and classifier levels.  Currently WAAS provides marking only.  There is no action taken by WAAS based on the DSCP value.
    Regards,
    Zach

  • How does QoS work with WAAS WCCP? What's the interaction between QoS Traffic Classification and WAE Traffic Application Policy?

    How does QoS work with WAAS WCCP? What's the interaction between Router QoS Traffic Classification and WAE Traffic Application Policy?

    By default, WAAS preserves the DSCP marking on intercepted packets.  There is a configuration option to set/override the DSCP value at the global (device), application, and classifier levels.  Currently WAAS provides marking only.  There is no action taken by WAAS based on the DSCP value.
    Regards,
    Zach

  • How do i work cheevos

    first add on cheevos all i got is a icon om my bar how do i work cheevos?

    Basically, Cheevos for Firefox is a game which encourages to try to attain certain achievements. It’s a system of achievements that will unlock and “toast” you with a small rectangular image on the screen every time you get one. If you visit the add-on’s about page once you have it installed, you’ll get a full list of the achievements, but it won’t tell you what you have to do to unlock them.
    In total, there are three levels to each achievement – bronze, silver, and gold. Until you unlock all three levels of one achievement, it won’t show you exactly how you got it.
    Read more at http://dottech.org/81916/firefox-make-your-browsing-more-fun-with-cheevos-for-firefox/#4IGfpCzJMJETJ7is.99

  • I have an old 30 GB iPod and it's taking hours to synch. How can it work quicker?

    I have an old 30gb iPod & it's taking hours to synch. How can it work quicker?

    If it previously worked much faster, there may be data corruption on the iPod's hard drive.  The best thing to do is to Restore it using iTunes.  Select the iPod in the iTunes sidebar, under DEVICES.  Over to the right, go to the Summary tab.  Click the Restore button.  This will ERASE (reformat) the iPod's hard drive, reinstall its software, and set it to default settings.  After Restore completes, re-sync content from your iTunes library.
    If you don't want to erase it, because it has content that is not backed up in your iTunes library, please post back...
    NOTE:  If this problem is caused by a mechanical problem on the iPod's hard drive (not just data corruption), it is possible that the Restore will fail, and your iPod will become non-operable.

  • How does 'RHPH_STRUCTURE_READ' work ?

    Hi all,
    I am using function RHPH_STRUCTURE_READ to find my system objects, but I don't understand how it exactly works, on attribute WEGID precisely !
    Here is the list of what I need to find :
    - O objects
    - SM linked to O
    - SE linked to SM
    - E linked to SE or E linked to CE
    For the first one, I use wegid 'O-S-P' (but I don't see what it does mean).
    For the two followers, I use otype 'O' and resp. wegid 'O-SM' and 'O-SE'. Is there a way to do from SM to SE without using otype 'O' and this wegid ?
    For the last one, I didn't find how to perform it !
    Someone can explain me how does it works ? My way to test it is really risky !
    Last question, is there a way to find all my O objects without notify an objid ?
    Thanks for your help
    Regards

    DATA:  v_wegid  LIKE t778a-wegid.
    DATA: T_PLVAR LIKE P1000-PLVAR,
          T_OTYPE LIKE P1000-OTYPE,
          T_OBJID LIKE P1000-OBJID,
          T_BEGDA LIKE P1000-BEGDA,
          T_ENDDA LIKE P1000-ENDDA,
    get data for 2 levels
      CALL FUNCTION 'RHPH_STRUCTURE_READ'
           EXPORTING
                plvar             = t_plvar
                otype             = t_otype
                objid             = t_objid
                wegid             = v_wegid
                begda             = t_begda
                endda             = t_endda
              PUP_INFO          = 'X'
              WITH_STEXT        = 'X'
                tdepth            = '3'
           TABLES
                stru_tab          = orgstru_tab
           EXCEPTIONS
                catalogue_problem = 1
                root_not_found    = 2
                wegid_not_found   = 3
                OTHERS            = 4.

Maybe you are looking for

  • Cam I use Asus mini display to VGA adapter on mac with thunderbolt port

    I don't have a apple mini display to vga adapter, but my friend have a Asus branded with similar design like apple, I have a presentation two days more, so I need answer quick!!! My mac: 2012 mid 15 inch

  • Problem with LOVINput in a  region

    Hi, I have created a region with 2 messagetextinput beans and one messagelovinput bean and attached this region to a page, then all the fields are working properly. But when setrendered for this region is false and on an event, in processform request

  • High CPU & Memory issues - Excessive and unnecessary CPU usage in Firefox for Windows (see also questions1003966 & 998289)

    I am using the latest version of Firefox, 32.0.1, on an HP Pavilion dv7-4141sa laptop computer, running Windows 8.1 Pro 64-bit. There should be more than enough power here to run a browser without any problem, yet the computer is regularly being over

  • ITunes just won't open?

    i don't know what is wrong with my iTunes. i double click on the shortcut and iTunes just won't open. then i try and click on it from the start menu, and nothing again. i have uninstalled and reinstalled iTunes about 3 times and still nothing changes

  • .AVI files not playing correctly on G3 iBook

    With the help of JulieJulieJulie and others I am able to import my mpeg 4 video clips (they are in .avi format on my Casio Exilim EX S600 digital camera) into iPhoto and play them without any difficulty on my G5 iMac and my G4 Powerbook. This morning