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.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

Similar Messages

  • 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.

  • 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.

  • 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.

  • 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

  • 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.

  • Color of Hierarchy Level

    Hello All,
    I have a workbook in which I have put a query which is having cost center hierarchy.  I want to assign a color of my choice to one level of hierarchy.  Is it possble to assign color to hierarchy level?  If yes, Please help me how to do so, since I have tried a lot to achieve this.
    Thanks a lot for your kind help.
    Ajay Ahuja

    Hello,
    You need to use stylesheets to change this. When the output of a query is formulated in a web layout, BW ads a number of classes in you html code. Depending on the class a lay-out is formulated; So here's what you need to do:
    - Execute a query and look at the source code of the result page. Find the result row and see what classes are use.
    - Create a customer css file and upload it in the mime repository (SE80). Set the cell background color for that particular class to the color you prefer.
    - Edit your web template to include the customer stylesheet
    Let me know if any of this is unclear.
    Thanks.
    With regards,
    Anand Kumar

  • 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

  • Cannot deactivate hierarchy in Query

    Dear all,
    From my problem is about activate/deactivate hierarchy for query in SAP BI version 7.0 whether query running on portal or on Business Exploeror(excel).
    First of all, this query is reported about cost center value and amount.
    I set the user with authorized for responsibled cost center.
    This user can access and run this query for responsibled cost center with hierarchy display active without error.
    And i see that, this report is filter with the user authorization, that's correct.
    But my problem is ...when this user deactivate the hierarchy in the query, the message " User is not authorized" will be showned. It's mean that the auto-filter doesn't work.
    How can i set the authorization to user which can deactivate hierarchy and see data only responsible cost center?
    Thanks for any help in advance.
    Best Regards,
    Lavitra P.

    Thanks for your information.
    I have set authorization in authorization object: S_RS_AUTH (the value of this object will be cost center) and authorization is based on hierarchy node.
    Moreover, in model, character is flagged as auth-relevant. (if not set as auth-relevant, i think that the cost center will not be check as authorize)
    for checking SU53, i already done and the system require S_RS_AUTH with value 0BI_ALL which is the value of root of cost center (highest node). and if i assign this, although i can deactivate hierarchy but all cost center data will be shown ( not only responsible cost center) that user can see data in other cost center so it's not correct way to solve this problem.
    Do you have the way to set without auth-check fail?

  • 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.

  • Material Group Hierarchy Level 1 - Description

    Hi,
         We required Material Group Hierarchy Level 1(0RPA_WGH1) DESCRIPTION. we find data source 0MATL_GRP_1_TEXT to
    get description. that standard data source created based on table TVM1T. We did find any data in that table. kindly guide me
    how to acheive this.
    Thanks

    hi rajendra,
    just check table T023T, hope this will help u.
    thanks

Maybe you are looking for