Regd:hierarchy level query

hi friends,
i have a one employee table.
empid mangid.
1 0
2 1
3 2
i wanted display hierarchy level of the employee like..
wanna display uppper & lower mangid of employee.
if suppose i pass empid=2
then it should display hierarchy like...
managerid
0
3
because empid=2 parent of empid=3 and Chiledid of mangid=0.

Hi,
For this you have to use Connect by clause and Start with Class ,
Using This we can get Hirarical Data.]
SELECT empno,
ename,
job,
mgr,
hiredate
FROM emp
START WITH mgr IS NULL
CONNECT BY PRIOR empno = mgr
try like this
Thanks,
Sanjeev.

Similar Messages

  • Regd:- hierarchy level query help.

    Dear Friends,
    i have query like below.
    select empid ,empname from employee; (Deptid FK with department master table.)
    now i want to display department name also in above query. from Select deptname from dept;
    in deprtment table master table data as below...
    deptid deptname
    1 IT
    2 SALES
    3 BOE
    4 ACCOUNTS
    but i want output like below...
    EMPID ENAME DEPTNAME
    101 JON SALES,BOE,IT
    102 JEK SYS,ACCOUNTS.
    how should written the query...?
    pls help.

    Try this
    with employee
    as
    select 100 empno, 'karthick' ename from dual
    union all
    select 101 empno, 'rajnish' ename from dual
    , dept
    as
    select 100 empno, 'IT' dname from dual
    union all
    select 100 empno, 'SALES' dname from dual
    union all
    select 101 empno, 'IT' dname from dual
    select empno, ename, ltrim(sys_connect_by_path(dname,','),',') dname
      from (
              select e.empno, e.ename, d.dname, row_number() over(partition by e.empno order by d.dname) rno
                from employee e
                join dept d
                  on e.empno = d.empno
    where connect_by_isleaf = 1
    start with rno = 1
    connect by empno = prior empno
       and rno = prior rno+1and
    Please consider the following when you post a question.
    1. New features keep coming in every oracle version so please provide Your Oracle DB Version to get the best possible answer.
    You can use the following query and do a copy past of the output.
    select * from v$version 2. This forum has a very good Search Feature. Please use that before posting your question. Because for most of the questions
    that are asked the answer is already there.
    3. We dont know your DB structure or How your Data is. So you need to let us know. The best way would be to give some sample data like this.
    I have the following table called sales
    with sales
    as
          select 1 sales_id, 1 prod_id, 1001 inv_num, 120 qty from dual
          union all
          select 2 sales_id, 1 prod_id, 1002 inv_num, 25 qty from dual
    select *
      from sales 4. Rather than telling what you want in words its more easier when you give your expected output.
    For example in the above sales table, I want to know the total quantity and number of invoice for each product.
    The output should look like this
    Prod_id   sum_qty   count_inv
    1         145       2 5. When ever you get an error message post the entire error message. With the Error Number, The message and the Line number.
    6. Next thing is a very important thing to remember. Please post only well formatted code. Unformatted code is very hard to read.
    Your code format gets lost when you post it in the Oracle Forum. So in order to preserve it you need to
    use the {noformat}{noformat} tags.
    The usage of the tag is like this.
    <place your code here>\
    7. If you are posting a *Performance Related Question*. Please read
       {thread:id=501834} and {thread:id=863295}.
       Following those guide will be very helpful.
    8. Please keep in mind that this is a public forum. Here No question is URGENT.
       So use of words like *URGENT* or *ASAP* (As Soon As Possible) are considered to be rude.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Hierarchy Level value displayed in BEx Query

    Is there a way to display the Hierarchy Level value (0, 1, 2, etc...) associated with each hierarchy level in BEx Query as a characteristic?
    we are currently using the Crystal Reports function HierarchyLevel(GroupingLevel(GL Account Node id)) to display the level of the node (0, 1, 2, etc...).  Is there something similar to this in BEx Query.
    We would like to use this Level value to do groupings in Crystal Reports.  When we try to create a Group, we can only create the groups on fields that are brought over in the BEx Query results.
    Thanks --

    Hi ,
    Hierarchy level can be defined in Bex query as well.
    In the query property there is option where you can say hierarchy active for that particular object.
    Also you can define level upto which it can be active in initial display say 3 level
    Also when you want to drill down further level 4,5 you can right click and select that particular level say 4 or 5 or 6.
    If you want to display hierarchy flat there is no option in BW then to right code,but I heard in crystal report it will automatically display in fl;at version as well  means
    Level 0 level 1   ......KF1 KF2  etc.
    Thanks and regards

  • Highlight hierarchy level rows in the query

    Hi,
    I have a requirement where I have to highlight the Hierarchy level specific rows.I have to highlight SAPBEXHLevel1,SAPBEXHLevel2,SAPBEXHLevel3 classes. Can someone explain me with a sample code on how to achieve this in ZCL_RSR_WWW_MODIFY_TABLE and to do what changes necessary. Points will be duly assigned.
    Thanks,
    Kal

    Table interface:
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/403c789a-aafb-2910-e5a4-835645f0721b
    http://help.sap.com/saphelp_nw04/helpdata/en/d8/f3a83adae1a010e10000000a11402f/frameset.htm

  • Limitation on Hierarchy levels

    Hi,
    I want to find out what is the limitation on number of Hierarchy levels (Custom Hierarchies) that can be created in BO Universe?
    And is this limitation oriented with the DB we connect?
    As I am using Netezza DB so I want to know the number of hierarchy levels that I can create for objects in  Netezza DB?

    We have a BEx query, having 9 product Hierarchy levels. When we are creating Universe, there is no issue. But when we do integrity check, getting a lot of parse errors and could not make the universe to work.
    Is there any limitation on number of herarchies to be supported from BEx query to Universe? Any OSS notes / Lessons learnt will be much appreciated. Please help urgently. Thanks.

  • Hierarchy Level in report

    Hi GURUS,
    I have a requirement in report i.e. I need to display the Hierarchy level from the 4th level only, I do not want to see the first 3 levels, where do I do the settings for that in reporting.
    I was told that there can be some settings done in Hierarchy tab of that info object in report level in Values of Posted Nodes. But even that option is disabled. If this is the way I need to do it then how to enable that option or if there is a different option then would appreciate if you explain me in detail. Thanks in advance.

    Hi ganesh,
    for this   same as normal procedure.. but in BEX analyser..  in the query  designer window  properties.. I mean select ur hierarchy and right click and > select Ristrict-> and there you can select particular level of nodes only...
    so, there you can select all fourth level nodes..and  drag and drop it into right side window... and save it.. and execute the query..
    so, now you can get only Fourth level nodes only in the reporting level...
    i think this will helpfull to u..if it's ok ... Reward me points..
    Thanks
    @jay

  • Creating a Hierarchy Viewer query

    Hello,
    I'm having huge difficulties creating a Hierarchy Viewer Query. I've looked through the source code contained withing the demo, but it seems to require great knowledge regarding the component. I'm using a three-node model, each node grouped within it's parent.
    So I created a custom View to be used as a result list for the query and this part is working just fine. I can pick the unique ID for the node I want from the search results when the user selects one, but I don't know how I can make that specific node my "anchor", my "current node", after that.
    Since I'm looking for a specific "contact_id" selected from the search results, I think the correct way of doing it is finding it's node on the TreeModel, and then setting it as my current anchor.
    Please, any tips, directions or suggestions on how can I go about doing this?
    Thanks!!

    Hi!
    Thanks for the attention, but I've been through all the basic stuff. The HV documentation only teaches the most primitive part of it. I searched all blogs related to HV, all articles I could find, I've meddled with the demo source code and all I can think of, but I couldn't find anyone who would give much insight on the mechanics of the component or how to build a really powerful search engine for it.
    As a sugestion for the developer team, it would be great if the query for this component allowed us to specify actions to be performed on all levels of the tree, instead of only the root node, since most of the time people use HV as a multi-root tree.

  • Changing the dimension hierarchy level keys in RPD online mode caused issue

    Hi,
    We tried to correct the dimension hierarchy level keys and remove prefered drill path settings in the business model layer in RPD in online mode. However this caused all the reports and dashboards based off of this subject area to show incorrect, and/or restricted data. The physical query generated by the answers requests were also incorrect.
    Even restarting the server and presentation services could not resolve the issue. Can someone please help us to understand what could have caused this issue?
    Thanks in advance

    Hi,
    I am not sure why the existing reports throw an error when I change the RPD dimension hierarchy level keys. Does anyone know how I resolve this issue.
    This is urgent. Any help will be most appreciated.
    Thanks in advance.

  • Activated Hierarchy Level

    Hi Everyone,
    Need to show the Activated Hierarchy Level in the reporting header (Upper left corner of the Excel Sheet). Is there any way. I tried out the option of activating the display option if the "Value of Nodes" in the properties of the hierarchy. Do give me a suggestion.
    Thank you,

    Hi Marc,
    In the query designer screen when you choose an hierarchy. In the Properties below it you have the option of choosing 'Expand to Level'. It gives a number by default. But you can change that also. so I want this number to be displayed in the Excel sheet with the Hierarchy 'Text' or 'Key' which ever option we choose. Hope I am clear.
    Thank you..

  • Related to Hierarchy level

    Hi BI Gurus,
    From the SDN, i understood that hierarchy cannot be transported directly.
    i am creating hierarchy in Quality as it is in Development. I have a doubt here.
    Now in my development system, i have 4 Hierarchy levels.
    But i am not able to create any level in Quality.
    When i press the "Maintain Level" button in quality, to my left hand side a window appears but there is no "create new" button.
    I would like to know, how to create the "Level"?
    Thanking you.
    Regards,
    Prasad.N

    Once you have maintain the hierarchies, you should be able to see the levels. Number of levels will depend on the hierarchies levels you maintained and then by clicking Maintain Level, you can change the description of the levels which will be useful at the time of query navigation.
    You can find the more details about Level Maintenance at following link;
    http://help.sap.com/saphelp_nw04/helpdata/en/0e/fd4e3c97f6bb3ee10000000a114084/frameset.htm
    On another note, you can also consider the option of loading hierarchy using a flat file. That way you can avoid maintaining hierarchy in all the systems. You just need to prepare the flat file once and then you can load it in all the systems.
    Regards,
    Gaurav

  • Hierarchy level

    Hi all,
    How I can explode the number of hierachy level in the query like in the below example?
    Committente/vendite     Hierarchy level
    DIVECO     1
    > ELETTR.SICILIA            1
    > ELETTR.CAMPANIA            1
    > ELETTR.LIGURIA            1
    > ELETTR.MARCHE                    1
        MEGA                    2
        ELETTRICA 88 S.N.C.            2
        F.E.D. FORN.ELETTR.            2
        ALESE LUIGI                    2
        VIMEL SRL                    2
        ELETTRICA CAROSI           2
    Thanks a lot
    Best regards
    Gianmarco

    > Hi all,
    > How I can explode the number of hierachy level in the
    > query like in the below example?
    >
    > Committente/vendite     Hierarchy level
    > DIVECO     1
    > > ELETTR.SICILIA            1
    > > ELETTR.CAMPANIA            1
    > > ELETTR.LIGURIA            1
    > > ELETTR.MARCHE                    1
    >     MEGA                    2
    >     ELETTRICA 88 S.N.C.            2
    >     F.E.D. FORN.ELETTR.            2
    >     ALESE LUIGI                    2
    >     VIMEL SRL                    2
    >     ELETTRICA CAROSI           2
    >
    > Thanks a lot
    >
    > Best regards
    >
    > Gianmarco
    > Hi all,
    > How I can explode the number of hierachy level in the
    > query like in the below example?
    >
    > Committente/vendite     Hierarchy level
    > DIVECO     1
    > > ELETTR.SICILIA            1
    > > ELETTR.CAMPANIA            1
    > > ELETTR.LIGURIA            1
    > > ELETTR.MARCHE                    1
    >     MEGA                    2
    >     ELETTRICA 88 S.N.C.            2
    >     F.E.D. FORN.ELETTR.            2
    >     ALESE LUIGI                    2
    >     VIMEL SRL                    2
    >     ELETTRICA CAROSI           2
    >
    > Thanks a lot
    >
    > Best regards
    >
    > Gianmarco
    > Hi all,
    > How I can explode the number of hierachy level in the
    > query like in the below example?
    >
    > Committente/vendite     Hierarchy level
    > DIVECO     1
    > > ELETTR.SICILIA            1
    > > ELETTR.CAMPANIA            1
    > > ELETTR.LIGURIA            1
    > > ELETTR.MARCHE                    1
    >     MEGA                    2
    >     ELETTRICA 88 S.N.C.            2
    >     F.E.D. FORN.ELETTR.            2
    >     ALESE LUIGI                    2
    >     VIMEL SRL                    2
    >     ELETTRICA CAROSI           2
    >
    > Thanks a lot
    >
    > Best regards
    >
    > Gianmarco
    Thank you,
    but I need to explode a hierarchy level like characteristic or key figure:
    Committente/vendite        Hierarchy level    QUANTITY
    > ELETTR.MARCHE                     1             60
         MEGA                           2             15
         ELETTRICA 88 S.N.C.            2             15
         F.E.D. FORN.ELETTR.            2             15
         ALESE LUIGI                    2             15
    Regard

  • Group a report based on a hierarchy level

    Hi,
    I'm struggling with a query that I'd like to group a report based on the selection of a hierarchy level.
    Here's the situation: I've got a table with a "normal" hierarchy, say the EMP table from SCOTT with its EMPNO and MGR columns. What I'd like to have is a report that gives me the sum of the SAL column group by all members on a given hierarchy level. So fi, if I choose LEVEL = 1, Id like to see the overall total, if I choose LEVEL = 2, I'd like to see the sum of salary of all employees managed by this respective manager etc.
    I know that there are possibilities to denormalize the table first and try to solve it from there, but what I'd like to know is whether anybody is aware of a more generic way to achieve that? What I could accept is a hard coded limitation of the number of nested levels, as this seems to be very hard to achieve in SQL.
    In the real scenario, I'm using only balanced trees, so from that point of view, the reports will be consistent.
    Any ideas?
    Thanks, Jürgen

    select l, sum(salary) from (SELECT last_name, employee_id, manager_id, salary, LEVEL l
    FROM employees
    START WITH employee_id = 100
    CONNECT BY PRIOR employee_id = manager_id) where l > :input_level
    group by l;

  • Displaying all GL accounts according to hierarchy level(Based on ERGSL)

    Hi all,
    I have a requirement to display balance sheet and PL account for the given period...
    1. I have to select all G L account numbers (BSEG-HKONT) with their amounts which belongs to same group (i.e. for those ERGSL value is same).
    2.Display sum at each hierarchy level with respect to company codes.
    From table FAGL_011ZC we can find the range of GL account (lower limit-VONKT upper limit-BISKT) and ERGSL using VERSN.
    In T-code FSE2 we can see the hierarchy levels.
    The table FAGL_011PC will get parent ane child relation ship for ERGSL.
    I have to display all these GL accounts according to hierarchy leve.
    please help me out in this regard.(if there any similer code it would be a great help).
    Thank you all in advance!!!!
    Ravi

    Hi Bhanu,
    thanks for your fast response, but this did not help. To make it more clear:
    Lets assume, I have the following hierarchy:
    <Root>
    |
    +- Good Customers
    |  |
    |  +- Customer_A
    |  |
    |  +- Customer_B
    |
    +- Bad Customers
        |
        +- Customer_C
        |
        +- Customer_D
    I have the customer in the free characteristics of a more complex query. I restricted it to the hierarchy node "Good Customers".
    In the web template i use a "Dropdown Box" with the customer as the assigend characteristic and read mode "Dimension".
    In this example the dropdown box would show the entries
    - All values
    - Customer_A
    - Customer_B
    But I would like to see the entries
    - All values
    - Good customers
    I already tried various settings in the query definition concerning the display hierarchy of the customer char with no success yet.
    Regards,
    Philipp

  • How to get the multidementional hierarchy level number ?

    Dear all,
    Could anyone tell me how to receive the hierarchy level number like the picture below:
    [click here for the Screenshot|http://yaoxin.de/download/level.jpg]
    as you can see, when i mouse hove on a level, it shows the level number.
    but, I want to get the level number 2 (node number 2) in query designer, but i can't find anywhere to show that.
    thank you for your kind help !
    Edited by: Xin Yao on Aug 26, 2011 1:04 PM

    hi Charlie Belt,
    Thank you very much for your answer.
    And yes, I do wish to perform a calculation based (aggregation) on the hierarchy level.
    How can I continue working on that?
    yao
    wish you have a nice weekend!

  • Hierarchy level - VERY VERY URGENT PLZZZZ

    Hi All,
    We have a requirement as displaying WBS hierarchy for 4th level and 7th level.
    WBS element master data attribute has Level in Proj. Hier. as a display attribute.
    we have changed it to navigational attribute and included in the query.
    When Level in Proj. Hier. as Display Attribute
    WBS Hierarchy --- Level in Proj Hier.
    Communication --- 1
    Mobiles --- 2
    Nokia --- 3
    Nseries --- 4
    N-72 --- 5
    N-71 --- 5
    When Level in Proj. Hier. as Navigational Attribute.
    WBS Hierarchy --- Level in Proj Hier.
    Communication --- 5
    Mobiles --- 5
    Nokia --- 5
    Nseries --- 5
    N-72 --- 5
    N-71 --- 5
    when i display the info object as navigational attribute, its is showing total no of levels in the hierarchy.
    Note: When i use this navigation attr in SAP Standard data tragets, then the result is coming properly...ther i can able to restrict this hierarchy....
    When i use the same in customised data targets( ceated by us) this navigational attr is not suppoting for restriction.
    How to resolve this prob?
    Please friends,give a solution for this issue......
    Points will be assigned for sure.....

    hi Suku,
    what's your bw version ? and support pakcage level ?
    it can be 'program error', i have searched with that error, only got 2 notes 628486 and 659474, which i think not relevant to your situation. did you create a message to sap reporting the error ?
    since the error occured only in web reporting, not sure
    if hierarchy nodes on web problem, web performance, query performance general oss note 567746.
    compression is done ?
    IV.   Web applications
    Performance analysis of Web applications: Tools for analyzing Web applications are available on the BW Performance page on the SAP Service Marketplace (service.sap.com/bw -> Performance).
    Note 568844: Very long HTML load times (compared with Analyzer) (up to BW 3.0B Support Package 7)
    Note 764394: Guide for performance improvement of Web
    V.    Compression of Web applications and browser caching
    Note 550669: Compressed transfer of BW Web Applications
    Note 561792: Client-sided caching of image/gif files
    Note 542576: HTTP compression is not active (up to kernel 6.20 patch level 251)
    how if you run the query with RSRT or RSRT2 with display option HTML ?
    hope this helps.

Maybe you are looking for

  • Reminder Alarm Time on Blackberry is incorrect

    When users create any appointment in calendar, as soon as the acceptance is on his BB, the Reminder Alarm on the B pops up. -BB shows alarmtime = 58218655 -Only users on my secondary PostOffice have this problem. -Appts are created on the PC (I have

  • 9-Slice scaling not working in FB4?

    I just upgraded my FB3 flash project to FB4.7, and saw that my 9-slice symbols (which I exported from an FLA to a SWC) have stopped working.  That is, the whole graphic is now getting stretched. If I use the exact same SWC and the exact same code in

  • IPhoto imports QT with wrong time from Panasonic FX7

    IPhoto does not correctly import the time for audio comments recorded with my Panasonic FX7 camera. Does anyone know of a fix (including an Automator program)? These comments are saved as QT movies (with a still picture naturally, not moving) and are

  • How to Download Code from SAPScrip

    Hi All, Did anyone know how to download the source code of sapscript? I want to copy the sapscript program from one system to another system. Is there any other way is there to do that? Please provide me with the solution.

  • FileInputStream  can't find file :(

    Hi everybody, I would like to open a fileinputstream. The file to be opened is with my source code and .class files of my project. I had to use absolute path so that the applet find find the file. Why ? Why cant I just put the filename or a relative