need to use the cursor for the query

Hi all
can someone tell me how to get the result of the following query using the slider?

SELECT (SUBSTR('        ', 1,LEVEL*2)
  || t1.label) AS t1_label,
  amount
FROM
  (SELECT t1.label,
    t1.ID,
    t1.parent_id,
    SUM(t2.turnover) AS amount
  FROM t1,
    t2
  WHERE t2.t1_id = t1.id
  AND t2.t1_id  IN
    (SELECT id
    FROM t1
      START WITH t1.ID       = 2
      CONNECT BY PRIOR t1.ID = t1.parent_id
    )
  GROUP BY t1.label, t1.ID, t1.parent_id
  ) t1
  START WITH t1.ID       = 2
  CONNECT BY PRIOR t1.ID = t1.parent_id;
.. .and the result:
t1_label             amount
---------------------------------------------------------
     B11     11778.54
      B121     19980.28
        B1211     18842.77
        B1212     25480.56
      B122     18339.07
    B12            23455.9
    B13            20876.52
Thank you
Alex

Published by: 860003 on June 9, 2011 01:30

Published by: 860003 on June 9, 2011 01:31

Published by: 860003 on June 9, 2011 01:31

decalare
V_T1_lable varachar2 (250);
Number V_AMT;
cursor c1 is SELECT (SUBSTR (' ', 1, LEVEL * 2))
|| T1. Label) AS t1_label,
amount
Of
(SELECT t1.label,
T1.ID,
T1.parent_id,
Amount of Sum (T2.turnover) AS
FROM t1
T2
WHERE t2.t1_id = t1.id
AND IN t2.t1_id
(SELECT id
FROM t1
START WITH t1.ID = 2
CONNECT BY PRIOR t1.ID = t1.parent_id
)
GROUP BY t1.label, t1.ID, t1.parent_id
) t1
START WITH t1.ID = 2
CONNECT BY PRIOR t1.ID = t1.parent_id;

Start
Open c1;
loop
Fetch c1 into V_T1_lable, V_AMT;
dbms_output.put_line(V_T1_lable||) e ---'|| V_AMT);
When Exit C1% notfound

end loop;
exception
When people then
dbms_output.put_line(SQLCODE||) e --'|| SQLERRM);
end;

Tags: Database

Similar Questions

  • do I need to use the product for the management of the recovery key to refresh the window 8.1?

    do I need to use the product for the management of the recovery key to refresh the window 8.1?

    No, the product key will be automatically read from the BIOS.

  • I used up to the allocation for the region 1 & 2 DVD for help. stuck on region 1 now. I need to use the two regions for my DVD. Help, please. Beryl

    I used up to the allocation for the region 1 & 2 DVD for help. Stuck on region 1 now.  I need to use the two regions for my DVD. Help, please. Beryl.

    It isn't a MS solution, there are solutions to third parties not supported by MS

  • "XYZ" is not in the scope. You may need to use an alias for "MNO".

    Hello

    I use 3 entities

    Global

    ABC

    XYZ

    All relationships are in one on one, Global contains ABC and ABC contains XYZ.

    XYZ contains a text MNO attribute and I executed the bottom rule in the doc of the rule of the OPM 10.3.1 and 10.4. In 10.4 it works fine where as in 10.3, I get an error "" XYZ" is not in the scope. "You may need to use an alias for"MNO""

    MNO is correct if

    MNO = "MARK".

    I would like to know why I get this error and the solution for it.
    Thanks in advance

    I highly recommend to undertake formal training. Then the OPA is easy to get up and run with, it's like any other powerful tool that once you start digging into the most powerful bits you need to have a better understanding of the underlying concepts to really get the best value.

    You must also make sure that read you the excellent guide of best practices of Jasmine

    http://www.Oracle.com/technetwork/apps-tech/policy-automation/learnmore/policymodelingbestpracticeguide-1371173.PDF

    So assuming that we still use the above very limited model (it's rare to see 1:1 too many relationships in practice) and you need to get this working on 10.3... essentially, what you're going to need to do is navigate the relationships to pass information to the entity levels - I'll use your feature names as on the model, but they write the rules more difficult to understand.

    I suppose that the text of standard relationship containment generated automatically.

    the global attribute value

    1 For(all instances of ABC, ABC has an MNO of "Mark")

    2 otherwise

    ABC has a MNO 'brand '.

    For (all instances of XYZ to ABC, MNO XYZ = "Mark")

    Although personally I would also enter the condition in the second rule to a conclusion so separate.

  • I installed Adobe elements 12 update to 6 items.  I need to use the save for Web function, but it is grayed.  I tried re-installing 12 items three times in case there was something missing, but this has not solved the problem and save the enemy

    I installed Adobe elements 12 update to 6 items.  I need to use the save for Web function, but it is grayed.  I tried to reinstall 12 items three times where it was missing something, but this has not solved the problem and enemy Save Web feature is always gray on. How can I get this feature too much work. I contacted the home and they have happened to you. I have 20 minutes to make a customers web work and if I don't work (about £500). Please advise/help.

    You are on the Expert tab in the editor?

  • the search for empty cells by using the query designer

    Hello

    I'm trying to exclude empty cells in a field (by using the Query Builder), and I did:

    xDocumentSource < match > "CDL".

    < AND >

    < NOT > (xRelatedMsgid < match > "" "")

    but it does not work. I tried "NULL", but it does not work either. Could someone tell me how to do it (or where I can find examples of queries).

    Kind regards

    Iwona

    https://blogs.Oracle.com/Kyle/entry/searching_for_null_values_ucm

  • Using the QUERY parameter in exp/expdp

    Hi, I've faced a nite last question.
    IM currently using Oracle 10 g (10.2.0.4) OS - MS Windows Server 2003

    I want a dump of tables to export multiple schemas. say (acb.m1, pqr.b2, xyz.b1)

    Each table has a minimum lines of 2,000,000,

    And I want to just the initials 10 rows in each table of export

    Is it possible that I can do this...

    Please answer.
    Thanks in advance

    Export tables in multiple schemas is not supported in Data Pump until 11.1.0.7. So if you're on 10g, you will need to run multiple commands expdp. For only 10 lines of each table, use the query parameter

    Query = "where rownum"<>

    This will apply to all the tables you export.

    I hope this helps.

    Dean

    Published by: Dean WINS January 30, 2012 08:42

  • Extend the VO - need to change the query of VO - screen is off

    {Re-post the message in this forum (thanks to John Stegeman to lead me here...)   {Posted: August 28, 2009 04:27}

    Dear all,

    Thanks to this great body of knowledge, I ask my questions.

    I need to extend a VO to display the name of the country.
    The column is not in the VO. So, I need to get another table: FndTerritories

    I want to change the query, but the request frame is turned off (in the wizard the View - step 5 of 6 - Generated statement object substitution)

    Could you be it someone please let me know: how to change the application of the VO in this case?

    OR is there another solution for such cases, to maintain development standards

    Thank you very much

    Kind regards

    Hello

    I think that's when you just have to add an attribute, you should not click the expert mode checkbox... make use of
    Mix and add the button.

    But when you need to modify the query, and then we want to use to modify the query window...

    Thank you
    Gerard

  • W530 need to use the external monitor as the main

    I have a training environment with the help of portable computers W530, who are locked in a box in front of the offices. It is not practical to reach the computer as it's hidden and so I need to use the dvi cable external monitor for the configuration of the bios, boot order, etc..

    Currently, boot options are hidden from the external screen until windows loads. The external monitor would then become active. A way around the monitor to the laptop altogether?

    Thank you

    Russ

    VGA is driven by Nvidia, so apply the same parameters. Comes to the boot monitor in VGA BIOS (I forgot what we call this specific setting, as my W530 is at home). You should always pass nvidia Optimus only.

  • one of my pc has placed on the bios supervisor password. now I need to use the bios settings to make some changes

    original title: supervisor password

    one of my pc has placed on the bios supervisor password. now I need to use the bios settings to make some changes, and I don't remember the password. What can I do to fix this?

    any practical advice will be much appreciated.

    Hello

    Check with support from the manufacturer of your system (manufacturer of motherboard for customized systems)
    or a real computer store (that makes its own domestic service).

    The Microsoft Community cannot help with password lost or forgotten by Microsoft Policy.

    Keep secure passwords - Microsoft strategy on move the passwords
    http://answers.Microsoft.com/en-us/Windows/Forum/Windows_7-security/keeping-passwords-secure-Microsoft-policy-on/39f56ef0-5d68-41AD-9daa-6e6019c25d37

    I hope this helps.
    --------------------------------------------------------------------------------------------
    Rob Brown - Microsoft MVP<- profile="" -="" windows="" experience :="" bicycle="" -="" mark="" twain="" said="" it="">

  • Computer still needs to use the Startup Repair tool

    Original title: my computer still needs to use the Startup Repair tool and I did a full scan of my computer and nothing came, so I don't know why I always have to use the Startup Repair tool

    I have windows vista

    Hello

    ·         The Startup Repair succeeded?

    ·         You receive an error message or error message?

    ·         Did you do changes on the computer before the show?

    Follow the suggestions below for a possible solution:

    Method 1: Follow the steps in the following article, and check, if that helps.

    Windows Vista or Windows 7 unbootable, and the Startup Repair tool does not resolve the problem

    http://support.Microsoft.com/kb/934540

     

    Method 2: I suggest you do the startup repair using the Windows Vista disc and check if that helps. Consult the following link for the Startup Repair.

     

    What are the system recovery options in Windows Vista?

    http://Windows.Microsoft.com/en-us/Windows-Vista/what-are-the-system-recovery-options-in-Windows-Vista

    Let us know if that helps.

  • Do I need to use the software provided with the wireless hardware to go wireless? __

    I have a router Linksys Wireless (wrt160n) that I am not using. I whant to buy a (Linksys WUSB600N) for my office. I want to know if I need to use the software supplied with the hardware, or can I just use Microsoft Wizard to configure my network? Operating system is Vista Premium.

    Thank you Jeremy will do.

  • I need to register cs2 once again, I need to use the part of the program bridge

    I need to register cs2 once again, I need to use the part of the program bridge

    There is nothing you can do to save your version/copy of CS2.  There is a special version for those who own CS2 and need to reinstall.  Infos and downloads are available through the following:

    CS2: Error: unavailable activation server | CS2, Acrobat 7, hearing 3 -.

    l http://helpx.adobe.com/x-productkb/Policy-Pricing/Creative-Suite-2-activation-end-Life.htm

    https://helpx.Adobe.com/Creative-Suite/KB/CS2-product-downloads.html

  • List of virtual machines in TIME using the query service

    Someone been able to use the query service to produce a range of virtual machines in a paralytic? I don't see all the attributes on the VclQueryadminVMField that reference the vApp.

    I log in the org of system.

    Any help would be appreciated.

    Name of the action: getVAppVms

    Entry: VAPP (vCloud:VApp)

    Output: Array / vCloud:VM

    Script:

    var vcdHost = vApp.getHost();
    var vms = new Array();
    
    var queryService = vcdHost.getQueryService();
    expression = new VclExpression(VclQueryVMField.CONTAINER, vApp.getReference().href, VclExpressionType.EQUALS);
    filter = new VclFilter(expression);
    params = new VclQueryParams();
    params.setFilter(filter);
    
    var resultSet = queryService.queryRecords(VclQueryRecordType.VM, params);
    while (resultSet != null) {
        var records = resultSet.getRecords(new VclQueryResultVMRecord());
        System.log(records.length + " VM records found");
        for each (var record in records) {
         var vmRef = new VclReference();
         vmRef.href = record.href;
         vmRef.name = record.name;
         vmRef.type = record.type;
         vms.push(vcdHost.getEntityByReference(VclEntityType.VM, vmRef));
        }
        resultSet = resultSet.getNextPage();
    }
    
    return vms;
    

    This is what made our team (more precisely - Christophe)

  • DataPump import by using the query

    Hello

    I need to import data by filtering using the query. can anyone help?

    Thank you

    Hello
    example of

    expdp HR/hr = emp QUERY:'"WHERE dept_id > 10 AND sal > 10000"' NOLOGFILE = y DIRECTORY = dpump_dir1 DUMPFILE = exp1.dmp

    Impdp HR/hr DIRECTORY = dpump_dir1 DUMPFILE = expfull.dmp QUERY = departments:'WHERE department_id «»< 120"'="" nologfile="">

    See this link

    http://download.Oracle.com/docs/CD/B13789_01/server.101/b10825/dp_import.htm

  • IMPDP | Possible using the query option

    HI PPL,

    I wanted to know if IMPDP is possible by using the query option, as I took full expdp dump of the mentioned table and want to import only select lines.

    Impdp arup/arup directory = demo_dir dumpfile = employees.dmp
    Query = employees:------"" where salary\ > 10000\ order of salary "tables used ="

    version: 10 gr 2
    platform: UNIX

    concerning

    Obviously, it will be slow if you are using the query option, because IMPDP must import only the data that meets the criteria; It of why we export only limited data (one or two tables as needed) and import them completely.

    Concerning
    Girish Sharma

Maybe you are looking for

  • Thunderbird 17.0.8 refreshes The lightning will not work with it.

    I have Thunderbird version 17.0.8 I have tried several times to update. I'm on Windows 7 Home Premium. I also tried to install the calendar of lightning, which apparently worked, but he will allow no data entry. In other words, it is apparently here

  • all freeze in my Mac?

    Hello! I have the mac book Pro MacBook Pro (retina, 13 inches, early 2015) 3.1 GHz Intel Core i7 16 GB 1867 MHz DDR3 10.11.4 my mac freeze sometimes I don't know why I need help please,. in this time my mac freeze 17:22 24/04/16 17:21:38, 000 syslogd

  • Sometimes windows to close (in view), but they are always "open". How can I get them back 'in view '?

    sometimes 'open' windows disappear. There is no crash. They are still in business, but not visible. How can I get them back in sight?

  • Plot a Point in a Pixel

    The help article to draw XY.vi led me to believe that the input argument of 'data' was x and coordinates are in pixels. So for an image which is 804 x 347, the point (400 175) terminates upward near the center of the image (near the bottom of the e w

  • ADM 32 GB will not allow a unique SSID and password to be put in place

    Sir / Madam,. I got a new 32 GB ADM.  I have updated to Firmware 3.04.  I was able to reset the Admin password without problem.  However, the unit will not allow an SSID / unique password to create its own network.  I typed the info in the settings/e