Access a Connect By Level variable from subquery

   With curr_date_details as
    select   to_date('16-dec-09', 'dd-mon-yy') as businessdate 
          ,  trunc( to_date('16-dec-09', 'dd-mon-yy'), 'iw') as bow
          ,  to_date('23-nov-09', 'dd-mon-yy')  as bop
          ,  trunc(to_date('23-nov-09', 'dd-mon-yy'),'iy')  as boy   
          ,  3 as week_nbr
          ,  3 as per_week_nbr
          ,  12 as per_nbr
   from dual
   select  --== Week Number
              case when level <= date_rec.per_week_nbr
                 then  level
                 when level = date_rec.per_week_nbr  + 1
                then 6
                when level = date_rec.per_week_nbr   + 2
                then  7
                    when level = date_rec.per_week_nbr   + 3
                then  0
            end as week_nbr
            --== Start Date
          , case when level <= date_rec.per_week_nbr
                 then  to_date('23-nov-23', 'dd-mon-rr')
                 when level = date_rec.per_week_nbr  + 1
                then  date_rec.bop
                when level = date_rec.per_week_nbr   + 2
                then  date_rec.boy  
                     when level = date_rec.per_week_nbr   + 3
                then  date_rec.boy  
            end as start_date
            --== End Date
           , case
                when level <= date_rec.per_week_nbr
                then   to_date('23-nov-23', 'dd-mon-rr')  + 6  
                  when level = date_rec.per_week_nbr  + 1
                then  date_rec.bow + 6
                 when level = date_rec.per_week_nbr  + 2
                then  date_rec.bow + 6
                        when level = date_rec.per_week_nbr   + 3
                then  date_rec.bop - 1  
             end as end_date
          --=== Dummy Column
          , case
                when level <= date_rec.per_week_nbr
                then ( select 1 + level as t  from dual)
                else  100
            end as pesky_column
      from dual mydual
      inner join curr_date_details date_rec on  date_rec.businessdate = to_date('16-dec-09', 'dd-mon-yy')
      connect by level <= date_rec.per_week_nbr  + 3gives me error:
Error at Command Line:9 Column:2
Error report:
SQL Error: ORA-01788: CONNECT BY clause required in this query block
01788. 00000 - "CONNECT BY clause required in this query block"
*Cause:   
*Action:
How can i access variable from subquery?
this question was taken from another post
Having trouble selecting from a table function

Hi,
Using a joiin:
WITH     connect_by_query AS
   select  --== Week Number
              case when level <= date_rec.per_week_nbr
                 then  level
                 when level = date_rec.per_week_nbr  + 1
                then 6
                when level = date_rec.per_week_nbr   + 2
                then  7
                    when level = date_rec.per_week_nbr   + 3
                then  0
            end as week_nbr
           --=== Dummy Column
       , LEVEL     AS lvl
       , per_week_nbr
      from curr_date_details date_rec
      connect by level <= date_rec.per_week_nbr  + 3
SELECT       cb.week_nbr
,       case
                when  cb.lvl <= cb.per_week_nbr
                then  NVL (sd.sales, 0)
                else  100
            end as pesky_column
FROM           connect_by_query     cb
LEFT OUTER JOIN      sample_data          sd     ON     sd.datakey = cb.lvl
ORDER BY  cb.lvl
;You could also compute week_nbr in the main query, rather than the sub-query.
Using a scalar sub-query:
WITH     connect_by_query AS
   select  --== Week Number
              case when level <= date_rec.per_week_nbr
                 then  level
                 when level = date_rec.per_week_nbr  + 1
                then 6
                when level = date_rec.per_week_nbr   + 2
                then  7
                    when level = date_rec.per_week_nbr   + 3
                then  0
            end as week_nbr
           --=== Dummy Column
       , LEVEL     AS lvl
       , per_week_nbr
      from curr_date_details date_rec
      connect by level <= date_rec.per_week_nbr  + 3
SELECT       week_nbr
,       case
                when lvl <= per_week_nbr
                then NVL ( ( select sales from sample_data where datakey = lvl)
                , 0
                else  100
            end as pesky_column
FROM       connect_by_query
ORDER BY  lvl
;Notice that the sub-query connect_by_query is the same in both cases.

Similar Messages

  • Access a instance level variable from activity in a subflow

    I have a flow such that it calls a number of subflows chained together.
    I have defined a instance variable to store a flag when a perticuler activity has been executed.
    in one of the subflows, there is an activity which i need it to update the parent level instance variable when it has done its task.
    but, i'm not sure how to get access to the parent level instance variables from an activity with in a subflow.
    I have PAPI code polling on the instance wating for this variable to change.
    any ideas?

    in a clip on the main timeline:
    var mc = this.parent;
    in a clip on the main timeline that was added with a loader:
    var mc = this.parent.parent;
    the first parent would be the loader
    the second parent is the loader's parent, or, the main timeline

  • Non-admin user cannot access Essbase server level variables

    Version 11.1.1.3
    Essbase Substitution variables are created at server level. Users are getting error in FR report that uses the Subsitution Variable -- Essbase Error(1051085): You do not have sufficient access to get this substitution variable. Also, users cannot access Substitution variable in SmartView. However, users can access variables created at database level. Users are provisioned as "Server Access" to Essbase and filter access to ASO application "MGTRPTG", where MGTRPTG is an ASO essbase application for reporting. We tried the same provisioning in two other environments and it seems to be working fine.
    User is type "Essbase and Planning" provisioned with essbase "server access", application mgtrptg "filter", Reporting and Analysis "analyst", "dynamic viewer" and "Explorer". In addition, it is given a filter "REP_DME_GALB" which restricts 2 dimensions (Division and Geography).
    Steps taken to resolve:
    1. Existing users were deprovisioned and reprovisioned with no effect.
    2. Created brand new identically provisioned users in Prod and QA. QA user can access the server level var and Prod user cannot
    3. Created a brand new server level variable in Prod and this cannot be accessed.
    4. All services have already been restarted several times.
    5. SR has been opened.
    Temporary workaround:
    By creating a duplicate of the same set of variables at the database level, the reports work. This can only be a temporary workaround as the client cannot be expected to maintain two sets of substitution variables since there are 3 applications using these server level variables.
    Thank you for any ideas!
    Jennifer

    You have stumbled on a defect which is resolved in the Hyperion Planning 9.3.1 patch 6 and above. If you have your planning preferences set to indent members it will cause forms which have page selections to show as invalid in SmartView.
    You can either patch Planning or turn off the preference. The patches are available from http://metalink3.oracle.com and require account which has been associated with your client ID.
    P.S. Usually it's not a good practice to use the admin id.
    Regards,
    -John
    Edited by: Jbooth on Nov 3, 2008 2:12 PM

  • How to access a USB disk drive connected to Airport Extreme from a Windows 7 PC?

    How can I access a USB disk drive connected to Airport Extreme from a Windows 7 PC?

    ...Called it a roaming network.  Wireless mode is create a wireless network. I have checked allow this network to be extended.  Probably need to uncheck that?
    Yes, that option should be deselected as it only pertains to when both routers are interconnected by wireless. Since you have a roaming network, they of course, would be interconnected by Ethernet.
    The other important settings for a roaming network are:
    Each router must have a unique station name. For the AirPort, this would be called its Base Station Name. I believe the default station name for Linksys routers is: linksys
    Each router must broadcast a wireless network with an identical Network Name. For the Linksys, Network Name is the same as its SSID.
    Each router wireless network must use the same Wireless Security type and password. The Linksys WRT-54G is capable of up to WPA2 Personal. If you have it set to this level of security, the AirPort should be at the same setting.
    Make sure that each router is not on the same Radio Channel for the 2.4 GHz radio. In the US, there are basically only three non-overlapping channels: 1, 6, or 11. Set each so that they don't use the same channel but use of those three choices.

  • Passing variables from Xcelsius to MS Access query

    Hi friends,
    I have established a connection of Xcelsius with MS Access through ODBC DSN. After getting connected I am able to access the queries and database tables of MS Access but the constraint I am facing now is I am not able to find a way to send some variables from Xcelsius(Excel) back to MS Access queries. I wonder if its possible or not. Please guide.
    Thanks,
    Gaurav
    Edited by: kgaurav2k6 on Feb 2, 2011 12:18 PM

    Hi,
    On this topic, How do you string multiple selections together...ie key 1, 2, 4, 6?
    I figured out how to implement range logic ">=" etc, but have yet figured out what format the cell needs to be in Xcelsius to pass successfully to Bex.  A single value works fine ie 1 or 2 or 4 or 6, just can't seem to combine them
    thanks
    jim

  • Dynamically Setting a Variable from a Connection String that has been set by a Config File

    Hi Guys
    I'm setting up a Master / Slave (Parent / Child) dtsx environment but I'm unable to work out how to dynamically set a variable in the Master dtsx from a connection string that has had its value set by a config file. I'm sure it's possible.
    Below is the what I'm hoping to achieve. I've set up everything apart from the highlighted section.
    Any ideas?

    First, what version of SQL Server are you using?
    You could switch the problem around.  You could set the value of a variable from the config file, then it is easy to use that variable as the connection string source for your connection manager.  At the same time you can use a parent variable
    configuration to map that variable to variables in your child package.
    Russel Loski, MCT, MCSE Data Platform/Business Intelligence. Twitter: @sqlmovers; blog: www.sqlmovers.com

  • Accessing variable from another JSP

    Friends,
    say, I have a Test1.jsp which has a variable "input". Is it possible to access this variable from other jsp "Test2.jsp"?
    any ideas?
    Thanks
    Hari V

    hi hari,
    there are essentially 3 ways of doing it....
    1).Usage of Hidden Values
    2).Using Cookies
    3).Storing attribute value within the scope of request/session/appln
    The choice is all urs....???
    Regards,
    RAHUL

  • How can I access JSP variables from a JavaScript function in a JSP page?

    Respected sir
    How can I access JSP variables from a JavaScript function in a JSP page?
    Thanx

    You may be get some help from the code below.
    <%
        String str="str";
    %>
    <script>
        function accessVar(){
           var varStr='<%=str%>';
           alert(varStr);// here will diplay 'str'
    </script>

  • Problem accessing variables from java file to JSP page

    Hello Everyone,
    I have small problem accessing my method variables from my java bean file to a JSP page. can some please take a look and tell me why I can't populate my JSP page, I've been trying all day to get this done!!!
    This is my Java file
    package dev;
    import java.io.*;
    import java.util.*;
    public class RoundDetail2
    public String string_gameID;
    public int string_card1;
    public String readDetail_topLayer;
    public static final String SUITS[] = {" ", "Clubs", "Hearts", "Spades", "Diamonds", "Joker", "FaceDown"};
    public static final String VALUES[] = {"Joker ","Ace", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine", "Ten", "Jack", "Queen", "King"};
    public static final String SuitVALUES[] = {" ","1","2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14"};
    public RoundDetail2() throws FileNotFoundException
    DataInputStream inFile=
                 new DataInputStream(
                    new BufferedInputStream(
                   new FileInputStream("C:/apps/jakarta-tomcat-4.0.6/webapps/ROOT/WEB-INF/classes/dev/Data_452SY2.txt")));
    try { 
                 while((readDetail_topLayer = inFile.readLine()) != null)
              StringTokenizer tokenizer_topLayer = new StringTokenizer(readDetail_topLayer,"\t", true);
                   while  (tokenizer_topLayer.hasMoreTokens())
                        string_gameID = tokenizer_topLayer.nextToken();
         catch(IOException e)
                    System.out.println(e.getMessage());
         Thanks KT

    ......How are you declaring the class in your JSP? ... are you instantiating it as a bean using the useBean tag, or just instantiating it in your code like normal.
    Maybe you could post the relevant JSP code too?
    Hello again,
    Only the last string is populating after the file has be tokenized. What I'll like to accomplish is passing the very first string in the file. I did not get too far in the JSP file setup because the code is still in it's testing stage, but any help will be highly appreciated.
    Here is the JSP code
    <%@page import="dev.*" %>
    <%@page session="true" language="java" import="java.io.*" %>
    <jsp:useBean id="wagerhist" scope="request" class="dev.RoundDetail2" />
    <html>
    <head>
    <title>Round Detail</title>
    <body>
      <table width="530" bordercolor="#000000" valign="top">
        <tr>
              <td align="left"  width="19%">Game ID<%=wagerhist.string_gameID%></td>
              <td align="left"  width="30%">  </td>
              <td align="left"  width="20%">card1</td>
              <td align="left"  width="31%">  </td>
            </tr>
      </table>
    </body>
    </html>

  • Is there any way at all of accessing captivate variables from flash?

    Hi,
    I would be grateful for any help on this one.  I have been working in flash and I wanted to know whether there is any way at all of calling/accessing captivate 4 variables from flash (I'm working in flash Cs4 Actionscript 3.0 and I'm trialling Captivate 4, but I just want to know whether there is any way/method of communicating between a flash file and a captivate 4 file, and if so, can this be done with an embedded captivate 4 file/swf).  Surely there must be a way of communicating between the two - they are both Adobe products!
    Thanks for any help, pointers, advice, tips in advance.

    Hi Louon,
    Don't know if this would help you.
    http://blogs.adobe.com/captivate/2009/09/captivate_variables_-_how_to_a.html
    We have many experts here who could give more precise answers.
    Cheers.
    Miguel

  • How to access the Custom Data type variable given in Expression edit control To and From LabVIEW

    Hello, I would like to know how to access the custom data type variable given in the Espression Edit Control from LabVIEW and vice-versa
    Say, the FileGlobals.Reference_Handle (Custom Data Type Variable) contains the
    VISA I/O session (Which in turn contains VISA_DeviceName: String, Session: Number),
    Channel1: Number and
    Channel2: Number
    I am expecting the user to give FileGlobals.Reference_Handle as the input at the ExpressionEdit Control in the edit screen of the VI Call.
    I would like to know how to get the values of this custom data type to LabVIEW?
    Say, if I have the Cluster in LabVIEW like VISA I/O session (Deive Name and Session Number), Channel1 and Channel2
    how do i need to set this cluster to the Custom Data type variable in TestStand?
    Thanks and Regards
    Prakash 

    Hi,
    TestStand to LabVIEW: i didnt understand what you r trying to achieve. But if you are using references, Use Property nodes and Invoke nodes to achieve what you want in LabVIEW.
     LabVIEW to TestStand: check the image below: You need to click the button next to 'container'. I have used a cluster output in the VI.
    Hope this helps
    .......^___________________^
    ....../ '---_BOT ____________ ]
    ...../_==O;;;;;;;;_______.:/
    Attachments:
    1.JPG ‏187 KB

  • Accessing public variables from other classes

    Probably a simple questions, but how can I access a variable from another class. My exact situation is as follows.
    A class called WorldCalender has a variable which is defined: public int hour; (the value is given to it elsewhere).
    I want to access this variable and increase it by one in a subroutine in the class Hour. In this class I have put: WorldCalender.hour++; but it doesn't seem to work. How should I do it?

    don't expose the hour variable at all.
    have a method eg addToHourBy( int hrs )
    Probably a simple questions, but how can I access a
    variable from another class. My exact situation is as
    follows.
    A class called WorldCalender has a variable which is
    defined: public int hour; (the value is given to it
    elsewhere).
    I want to access this variable and increase it by one
    in a subroutine in the class Hour. In this class I
    have put: WorldCalender.hour++; but it doesn't seem to
    work. How should I do it?

  • How to access (call) variables from multiple components

    I have what I think is a basic task, but I cant seem to get it to work.  I have a Flex project with one application.  In addition to the one application, I have many components that are used in the application.  These components vary from simple (a ComboBox) to complex (many sub-components).  What I need to do is define a viable in one component and access it in another component.  I can't seem to do this.  Below is an example of how I think it should be:
    Component1
    <mx:Script>
           <![CDATA[
            [Bindable]
            private var userID:int=0;
           ]]>
    </mx:Script>
    Component2
    <mx:TextInput  text="{Component1.userID}"/>
    Any help you can provide would be beneficial.
    Lee

    Hello,
         You may also want to consider using the mx.core method.
         In your main application script area define all of your public variables and functions. Then from your component, you can reference these absolutely with the following syntax.
    <!-- Main App -->
    [Bindable]
    public var userID:int;
    <!-- Component -->
    private function init():void {
         var com_UserID = mx.core.Application.application.userID;
    Using this method ensures that you will have access to any Function or variable within the scope of the project.
    Kind Regards,
    Dr. Ivan Alexander, Ph.D.
    Sr. Applications Engineer
    FlexAppsStore.com
    Sun Microsystems
    MySQL Enterprise Ready Partner 2009

  • Accessing Captivate 5.5 variables from embedded SWFs

    Hi,
    as we all know the interface for accessing Captivate variables from embedded SWFs tends to change between Captivate versions. Shortly after it's release we upgraded to version 5.5, and I'm not succeeding in accessing the Captivate variables in my Flash/AS3 code the same way it was done in version 5.
    How should I access the Captivate 5.5 variables (rdinfoCurrentSlide et al) from my SWFs?

    Hi,
    You can use system variable : cpInfoCurrentSlide to show the slide number.
    So you can use text captions to display the value of the variable, the format for displaying the value stored in the variable is $$<system variable>$$. So for slide number use : $$cpInfoCurrentSlide$$, type this in the text caption and then check it in the preview.
    Thanks

  • Access machines connected to router from machine connected to hub

    I have a DSL modem connected to a Linux firewall.
    The Linux firewall and numerous other machines are connected to a 100MB hub.
    This configuration has worked fine for many years.
    I purchased a Linksys WRT54GS for the wireless & 10/100 switch capabilities.  I have the Linksys connected to the hub via the hub's uplink port.  I have one wired and one wireless machine (both Windows) accessing the Internet just fine via the Linksys.  I can ping a Linux development machine connected to the hub from one of the Windows machines connected to the Linksys.  However, I cannot ping the wired Windows machine (has static IP address) nor the Linksys itself.  I am unsure if the Linksys is not responding to pings & not allowing them to go through to the connected machine, or, if I need to modify my firewall/gateway somehow.
    Any thoughts would be appreciated!
    Thank you kindly!

    Thanks for the reply!   I am just now getting back to this as it dropped in priority for a while.  My development box(es) on the hub is in the range of 192.168.3.x and the DHCP server on the Linksys WRT54GS dole out 192.168.4.x.  I am thinking I need a route configured either on the Linksys or my Linux gateway - does this make sense?
    Thank you!

Maybe you are looking for

  • Is it possible to create a webservice in APEX 4.0?

    I'm planning to use the upcoming APEX 4.0 web service feature for my new project. I would like to know whether it's possible to create web service in the upcoming APEX 4.0. As far I know, APEX can consume web service, but is it possible to create a w

  • Plz reply urgent!!!!!!!!!!!!!!!!!!!displaying the blank space with $0

    Hi all, Plz help Its very urgent!!!!!! I have a requirement to show the data of consecutive two months in the report with the difference of two months in another column "variance". ex: mm1/yyyy , mm2/yyyy, variance = mm1/yyyy-mm2/yyyy I have made a n

  • SAP HR - will it be a right choise

    Hi Folks, Glad to be a part of the SCN community. I am current working in a BPO, I am really passionate about SAP and have a strong will to make my carrier in SAP.Right now I am working with technical support. I have completed my MBA - HR and want to

  • HT4623 update ipad 2 to IOS5

    How do I iupdate my ipad 2 to IOS5 as on my ipad 2 I do not have the application SOFTWARE update? Please help. Thank you

  • HT1600 Update version 6 not available in Canada?

    After turning on AppleTv 3, it said update available and started to download something. After about 20 min. a message came saying update failed. Checked under Software Update in General, it said Software up to date, however checking the software vers