Parent to display in the query of the hierarchy

Hello
I want to display the details of the node relative to the hierarchy in the first row.
For example, if A hierarchy has child A1 and A2, then I want to display A hierarchy in the first line and the A1 and the A2 on the second and third respectively.

The details of the mother is in the PARENT_ID column and details of the hierarchy is in the HIERARCHY_ID column.

I need something like:
Select HIER_ID in the HIERARCHY
where HIER_ID IS PARENT

user1080784 wrote:
For example,.

HIERARCHY_ID PARENT_ID NAME
133 100 Trading
134 133 retail
135 133 Bank

In the output, I want details such as:

ID PID NAME PARENTNAME
133 100 exchange of Exchange
134 133 retail trade
135 133 commercial banking

user1080784 wrote: because they do not work

Maybe it works not because you asked the wrong question! I tested it and it works for me. In any case, this is my test;

SQL> create table HIERARCHY(HIERARCHY_ID number, PARENT_ID number, NAME varchar2(30));

Table created.

SQL> insert into HIERARCHY values (133, 100, 'Trading');

1 row created.

SQL> insert into HIERARCHY values (134, 133, 'Retail');

1 row created.

SQL> insert into HIERARCHY values (135, 133, 'Banking');

1 row created.

SQL> commit;

Commit complete.

SELECT HIERARCHY_id AS ID, PARENT_ID as PID, NAME "NAME",
NVL((select H1.NAME  from HIERARCHY H1 where H1.HIERARCHY_id = H.PARENT_ID),H.NAME) AS PARENTNAME
  3     FROM HIERARCHY H;

     ID       PID NAME                    PARENTNAME
---------- ---------- ------------------------------ ------------------------------
       133       100 Trading                    Trading
       134       133 Retail                    Trading
       135       133 Banking                    Trading

SQL> exit

Published by: orawiss on August 8, 2011 18:38

Tags: Database

Similar Questions

  • IOM 11 GR 2 - reconcile the hierarchy of the Organization for IOM org.

    Hello

    I try to reconcile organization hierarchy in connected AD ITResource, but can find no option to set the name of the parent organization to maintain the hierarchy of Organization IOM created reconciliation confidently.

    You have any suggestions, tip how to build hierarchy ORG in IOM with reconciliation?

    one.

    This can be done using recon trust. But write a separate scheduled task for this and call the OIM11gR2 API, which will create an organization based on given criteria. and call this task before recon trust so that the user will be reconciled against their corresponding organization.

    Call OrganizationManager.create (organization org) method of creating organization.

    Create the object organization like organization org = new Organization();
    then put all the required parameter and the name of the parent organization

    org.setAttribute (java.lang.String name, java.lang.Object value)

    ex: If orgname = org ABC and parent = XYZ
    org.setAttribute ( OrganizationManagerConstants.AttributeName.ORG_PARENT_NAME , "XYZ");
    org.setAttribute (OrganizationManagerConstants.AttributeName.ORG_NAME, "ABC");

    OrganizationManager orgManager = (OrganizationManager.class) Platform.getService;
    orgManager.create (org);

    You can set OrganizationManagerConstants.AttributeName.ORG_TYPE ('Company') so

  • How to use record group to insert data into the hierarchy tree?

    Hello

    I had a hierarchical tree in my block and I want to use the record group to display
    in the hierarchy tree, call david_tree. He did work for the code I try below
    and I think it might be that the create_group_form_query was wrong? or miss an order?


    DECLARE
    htree;
    rg_data RECORDGROUP;
    v_ignore NUMBER;
    BEGIN
    htree: = Find_Item ('tree_block.david_tree');

    rg_data: = CREATE_GROUP_FROM_QUERY ('rg_bank',
    "select name, short_name".
    || "from css_banks");

    -Fill the record with data.

    v_ignore: = POPULATE_GROUP (rg_data);

    -Transfer the data from the record group to the hierarchical
    -tree and bring it to display.

    FTREE. SET_TREE_PROPERTY (htree, FTREE. (RECORD_GROUP, rg_data);

    END;


    Thank you


    David

    David,
    You get an error with your code? Looks like you took your example code help Forms. I don't really see a problem with the code, but the forms example gives an example of how create the record group used by the HTree so the Receiver General may be the cause of the problem. When I used the HTree, I used the FTREE. Procedure ADD_TREE_DATA to fill the tree. When I started working with HTree I created a wrapper package to simplify the process. You can watch how I work with the HTree in a demo that I published called: forms and how to: create a shape of the HIERARCHICAL tree.

    Hope this helps,
    Craig B-)

    If someone useful or appropriate, please mark accordingly.

  • Is it possible to change the number of lines to display in the query of the adf?

    Hello

    is it possible to change the number of lines that appear in a query of the adf that is similar to a form of the adf?

    I need about 5 lines per column rather than display all the fields in a single column to display? Thank you.

    Hello

    What do you mean that it didn't work? Attributes of how you have in the Panel of the query? Maybe you have fewer number than the combination or lines and the properties of the argument maxColumns attributes.

    Try again with

    and see if you are able to get everything under a single column. If you get, play with these two properties to get the desired result.

    Arun-

  • Filter the table display of the query object (it can a bug in jdev 12)

    Hello:

    I found an error/bug possible in jdeveloper 12 c when I migrate my application of jdev 11g.

    To test this issue, I did the same test request in jdeveloper 11g and jdeveloper 12 c (to avoid to migrate the process).

    Project template

    -Create a display of the query object. Code:

    SELECT 1 CODE, 100 DESCRIPTION
      FROM DUAL
    UNION ALL
    SELECT 2 CODE, 200 DESCRIPTION
      FROM DUAL
    

    -Create a Module of the Application, and then drag this point of view in.

    ViewController project

    -Create a page and drag in the criteria named 'All searchable attributes' of the previous ViewObject as "ADF table filtered.

    -Run the application

    Results:

    On jdeveloper 11g, however it makes the filter above the table box in jdev not 12 c.

    Is this a bug or I need to select something in jdev12c to get the same functionality?

    Yes, known bug 17279781.  It is currently scheduled for a 12.1.4 fix.  If this issue is crucial to you, please file an SR, mentioning the bug number and indicate your reasons for wanting a fix as soon as possible.

    Note there is a solution:

    To work around the problem, you can configure the filter yourself by adding an af:inputText

    facet filter columns and bind the inputText property value to the EL

    #{vs.filterCriteria. }. The page to rerun the filter for

    the column look and work.

    CM.

  • Random display of the results of the query (no repeat)

    First of all, I'm new to ColdFusion, so please forgive me if the answer to this is blantantly obvious, if not totally impossible. Here's my problem.

    I queries a database with several hundreds records. The query will return an average of 10-15 records. Then, I want to display 2 of these files at random. I have so much work. The only problem is that every so often, the 2 folders that are displayed are the same record. I need avoid this outcome. The 2 folders should be always different.

    Here is a simplified version of my code:

    < CFQUERY "queryname" datasource = name = 'Datasourcename' >
    SELECT * FROM residential
    WHERE ListingOfficeName = 'Steve Realty.
    < / CFQUERY >

    < cfset randRecordsList = ">
    < cfloop from = '1' to '2' index "i" = = >
    < cfset randVal = randRange(1,queryname.recordCount) >
    < cfset randRecordsList = listAppend (randRecordsList, randVal) >
    < / cfloop >

    < cfloop list = "" #randRecordsList # "index 'i' = >"
    < cfoutput >
    #queryName.FieldName1 #.
    #queryName.FieldName2
    #.
    #queryName.FieldName3 # < br >
    < / cfoutput >
    < / cfloop >

    Any help would be appreciated. Thanks in advance.

    Here's the general idea. You can handle the specifics.

    generate a list of numbers.
    maxnum = 15;
    numlist = "";
    for (i = 1; I lte maxnum; I = i + 1)
    numlist = listappend (numlist, i);

    randomnums will be two random numbers
    RandomNums = "";
    x = true;
    While (x is true) {}
    ThisNum = plageAleatoire (1, maxNum);
    If (ListFind (RandomNums, ThisNum) is false)
    RandomNums = ListAppend (RandomNums, ThisNum);

    If (ListLen (RandomNums) 2)
    x = false;
    }

  • MineCraft will not be displayed on the child with parental control account

    Hello!

    I saw this thread answered for someone else... can you help me?  Same thing applies, security for the family, is on the side parents but not to the connection of the child. Cruelly by a nine year old :)

    For that to work, I installed Minecraft while logged in as an administrator. Then, I changed the permissions on the shortcut to add the "child" Windows user account I created. I gave that Win User all permissions account and then restarted. After that I connected to the account of the 'child' and launched the shortcut on the desktop and it worked.

  • query for the path of the hierarchy of the child to the parent for a child key given by the user

    CREATE TABLE EMP_ID
    (
      HEAD_ID  NUMBER(4),
      TAIL_ID  NUMBER(4),
      NAME     VARCHAR2(20 )
    )
     
    Insert into EMP_ID  Values  (1011, 1008, 'C11');
    Insert into EMP_ID  Values  (1008, 1003, 'C8');
    Insert into EMP_ID  Values  (1012, 1003, 'C12');
    Insert into EMP_ID  Values  (1020, 1003, 'C20');
    Insert into EMP_ID  Values  (1025, 1003, 'C25');
    Insert into EMP_ID  Values  (1015, 1012, 'C15');
    Insert into EMP_ID  Values  (1012, 1005, 'C12');
    Insert into EMP_ID  Values  (1005, 1017, 'C5');
    COMMIT;
    now my requirement is like this

    If choose the head_id as 1012 and 1017 as tail_id
    It should cross the path shaped tail to print the path as shown below
    c12/c5/c17/c12
    such as this shows that tail_id was used previously as head_id in the path of the hierarchy.

    Here is the hierarchy as shown below
    1015
          1012
                1005
                    1017

    Rede,
    Is that what you want?

    CREATE TABLE EMP_ID
    (
      HEAD_ID  NUMBER(4),
      TAIL_ID  NUMBER(4),
      NAME     VARCHAR2(20 )
    );
    
    Insert into EMP_ID  Values  (1011, 1008, 'C11');
    Insert into EMP_ID  Values  (1008, 1003, 'C8');
    Insert into EMP_ID  Values  (1012, 1003, 'C12');
    Insert into EMP_ID  Values  (1020, 1003, 'C20');
    Insert into EMP_ID  Values  (1025, 1003, 'C25');
    Insert into EMP_ID  Values  (1015, 1012, 'C15');
    Insert into EMP_ID  Values  (1012, 1005, 'C12');
    Insert into EMP_ID  Values  (1005, 1017, 'C5');
    Insert into EMP_ID  Values  (1017, 1012, 'C17');  ---- ==== This was missing in your setup example
    COMMIT;
    

    QUERY and OUTPUT

    SELECT *
      FROM (
    select
      connect_by_iscycle as CYC
     ,dt.head_id
     ,dt.tail_id
     ,sys_connect_by_path
                      (  dt.name
                       ,'/'
                      ) AS EMP_PATH
    from   emp_id dt
    start with dt.head_id = 1012
    connect by  NOCYCLE  dt.head_id= prior dt.tail_id)
    ;
    
    CYC     HEAD_ID     TAIL_ID     EMP_PATH
    0     1012     1003     /C12
    0     1012     1005     /C12
    0     1005     1017     /C12/C5
    1     1017     1012     /C12/C5/C17
    0     1012     1003     /C12/C5/C17/C12
    

    If you want just the printed path

    SELECT *
      FROM (
    select
    max(sys_connect_by_path
                      (  dt.name
                       ,'/'
                      )) AS EMP_PATH
    from   emp_id dt
    start with dt.head_id = 1012
    connect by  NOCYCLE  dt.head_id= prior dt.tail_id)
    ;
    
    /C12/C5/C17/C12
    

    pre
    Sudhakar B.

  • Interactive report with display of the icon to set the page element

    Hi all

    I am currently using Apex 4.2.4, I have an interactive report using icons, each icon has a link to another page but a few I want to set a value in a page hidden in the same page element which is then used as a variable for a classic report.

    I have this work via link href in the icon as f? p ='|| FA.page |': 1 :'|| : app_session |': P10_ID_ITEM :'|| FA.link_name without error.

    My problem is that I wanted to put the value of the element without using a link href that I could handle the clicked icon to change the background color so that the user can have a Visual representation, where it was clicked, then using the value of the page item appears the classic report in another region with a partial refresh.

    Any help is appreciated, thanks.

    Can you provide a detailed explanation of the purpose of this report and the logic used in the report query? What are the rules to control which icons appear in the IR, what icons link to the second report on the page of IR, and icons to link to separate pages?

    For me, the report query seems too complicated and inefficient by returning the data it does, and if another level of data is added to the hierarchy or more data is added to the second level, it fails with:

    ORA-01427: einreihig subquery returns multiple rows

    I'm guessing that the intent is that the IR displays only the icons at the top level of the hierarchy and icons for posting a link to a different page when they have no descendants, or to display the related lines in the secondary report below the IR when they do. I created a new page with the report query modified to a route of tree and keep the upper level lines. It is much more effective than the original query and simplifies the logic necessary for the verification of end-nodes. Instead of generating a URL link (which violates the separation of concerns), the query returns of the discrete values that can be used to implement the HTML link in the Icon View link Custom property:

    with icon_tree as (
          select
              ic.id_icon
            , ic.icon_name
            , ic.link_name
            , nullif(connect_by_isleaf, 1) is_parent
            , level depth
          from
              icons ic
                connect by
                    prior ic.link_name = ic.id_parent
                start with
                    ic.id_parent is null)
    select
        id_icon
      , icon_name
      , link_name
      , apex_util.get_blob_file_src('P10_ICON_IMAGE', id_icon) img_src
      , nvl2(is_parent, '586', link_name) target
      , nvl2(is_parent, 'P586_ID_PARENT', null) parent_item
      , nvl2(is_parent, link_name, null) parent_id
      , :app_id app_id
      , :app_session app_session
      , :debug debug
    from
        icon_tree
    where
        depth = 1
    

    In the interactive report, Use Custom Icon Link is set to Yes, and the custom link is:

    
      
      
    #ICON_NAME#

    Public static ID icons and results are applied to the IR and the regions second report respectively for use as selectors in action dynamics and CSS. The protected value property for the page P586_ID_PARENT element must be set to No for the value can be defined by a dynamic action.

    Dynamic action with several real actions is needed to bind alternatives click behavior to the links on the icons that have descendants (i.e. where the data-parent-id attribute has a value):

    Event: Click

    Selection type: jQuery Selector

    jQuery Selector:.apexir_WORKSHEET_ICONS a:not([data-parent-id=""])

    Real Actions

    Seq: 10

    Action: Delete the class

    Class:selected

    Selection type: jQuery Selector

    jQuery Selector:.apexir_WORKSHEET_ICONS a

    Seq: 20

    Action: Add the class

    Class:selected

    Selection type: trigger element

    Seq: 30

    Action: Set value

    Wait for result: Yes

    Type of value: Expression of JavaScript

    JavaScript expression:$(this.triggeringElement).attr('data-parent-id')

    Selection type: Agenda

    Point: P586_ID_PARENT

    Seq: 40

    Action: Discount

    Selection type: Region

    Region: results

    Seq:50

    Action: Show

    Selection type: Region

    Region: results

    Seq: 60

    Action: Cancel event

    Finally, add a style sheet to the Inline CSS property page. Initially, this hides the secondary report and select the parent clicked icon:

    #results {
      display: none;
    }
    #icons .apexir_WORKSHEET_ICONS a {
      border: 1px solid transparent;
      border-radius: 3px;
      padding: 0.8em 0 0.5em;
    }
      #icons .apexir_WORKSHEET_ICONS a.selected {
        border-color: #6a9cda;
        background-color: #bbd1ec;
        transition: 0.6s;
      }
    

    However, after all it is the question of why you use an interactive report here if you turned off all the features of the IR? A dynamic list with a custom template box seems to be more applicable?

  • First connect by: display of all of the hierarchy even if parameter child

    31%

    Hello

    In our case the manager_id I = employee_id for high level manager. So when I run the sql code, it eliminates the high-level manager and shows the output for the next level of leave.

    For the regular start with you connect option on the employee table, the query used is
    select case when connect_by_isleaf = 1 then 0 when level = 1 then 1 else -1 end as status,
           level,
           First_name as title,
           NULL  as icon,
           EMPloyee_id as value,
           First_name as tooltip,
           NULL  as link
    from EMPLOYEES
    start with Manager_id is null
    connect by prior EMPLOYEE_ID = Manager_id
    order siblings by First_name
    now, this will show the hierarchy and level from managers. Now, if we provide the 'start with Manager_id = 171' then as 171 isn't a Manager no row is returned. So, for this we can use something like
    start with manager_id =171 or employee_id = 171
    However, the output would be only the employee from 171 record is the last child.

    The requirement we had was that, regardless of the value entry, be it ultimate parent or child ultimate output should always display the top to the bottom of the hierarchy. from this ultimate Manager of people.

    Thus, for example, if there are two employees, 170 and 171 and 170 is the Manager of 171

    If in this application, I use Start with Manager = 170. He will show me the Manager and the child records.

    However, if I use start with manager = 171 or employee_id = 171, then it will show me only only the registration of the child. I want that he show me the Manager and the employee records. That is, all levels

    I hope that makes sense!

    Thank you
    Ryan

    Published by: ryansun on December 12, 2012 01:13

    Published by: ryansun on December 13, 2012 01:59

    Hello

    Maybe you should post your results with different cases.

    See if it fits your needs:

    WITH entire_tree AS
    (
        SELECT *
          FROM employees
         START WITH manager_id = 171
       CONNECT BY PRIOR employee_id = manager_id
       UNION
        SELECT *
          FROM employees
         START WITH employee_id = 171
       CONNECT BY employee_id = PRIOR manager_id
    )
     SELECT CASE WHEN CONNECT_BY_ISLEAF = 1 THEN 0 WHEN LEVEL = 1 THEN 1 ELSE -1 END AS status
          , LEVEL
          , first_name AS title
          , NULL AS icon
          , employee_id AS VALUE
          , first_name AS tooltip
          , NULL AS link
       FROM entire_tree
      START WITH manager_id IS NULL
    CONNECT BY PRIOR employee_id = manager_id
      ORDER SIBLINGS BY first_name;
    

    Kind regards.
    Al

  • measurement on the display of the tds5034 Tektronix OScilloscope

    I collect data from the Oscilloscope with the Tektronix TDS 5034. I have a problem on the display a light, as on his screen, I know not the appropriate query to use, is there at - he know how to display such a thing? I already read the programming guide, but I can't find any command. or if you you see me just the "query" to show on the oscilloscope screen, because now I know mannualy go to settings of measure of CSOs. just to show them

    Thank you..

    I have this Programming Guide , but I can't understand the correct query,

    I just tried this query, but gives me error rather expect the display on the screen of the OSC, , I also try to add CH before measurement: MEAS1:TYPe AMPlitude;

    but I get the error in the code entry VISA:-1073807339

  • Parental control unavailable since the change of e-mail account in Outlook

    I can no longer access or control security settings for the family since the evolution of my hotmail account outlook account, as recommended by Microsoft.  An omnipresent annoying popup asking me to write in my pw, but the user ID is always displayed as my old account hotomail and I am unable to change that.  So I tried, but a message says that it is incorrect, which, of course, it is.   Now I wonder if I will be unable to install new software if my account name is not recognized?

    I have Windows 7 64 bit on a desktop (which a year ago, I have upgraded to Vista), most most recent win-7 64 - bit specifications.  No machine gives me problems in any other respect.

    Hello

    You need to reinstall the Windows parental control client on the computer after you rename the parent account. For detailed steps, see the link below:

    http://answers.Microsoft.com/en-us/windowslive/Forum/family-profile/how-do-i-reset-the-parent-ID-in-family-safety/a5e8aa1a-ca0e-41ed-91b7-6cea9d8a3c95

    Please let us know if the problem still persists.

    Thank you!

  • "The parameter is incorrect" Error Message is displayed on the computer

    I'm running Windows 7 Home Pro on an Asus laptop and recently decided to add my old printer USB, HP Oficejet v40, to our network via a print server, LPR Networking USB wireless home. The Installer seems to fill correctly, and my printer appears in the list of available network printers (I alone). However, when I try to print wireless, I get one or more error messages. The first and the most persistent are: a StartDocPrinter call was not issued. Sometimes (not always) this is accompanied by another popup error: the parameter is incorrect. In each case, the document I am trying to print is no longer in effect. My USB utility Server network sometimes prints, and sometimes it is available. Running the printer troubleshooter cannot correct the problem (s) and always results in the following error: printer HP Officejet V40-P05d0443eb can be contacted via the network. If I connect the printer directly to my laptop, USB port, it prints as expected.

    The print driver is up-to-date. I tried to uninstall and reinstall the printer and print server and have also tried to reset the print server and the router, to anything will do. Any help to fix these problems is greatly appreciated!

    Original title: error: A StartDocPrinter call was not issued.

    Hello

    Thanks for posting your query in Microsoft Community.

     

    You can consult the following articles and check if they help:

    Wireless printing Center Resolution of problems
     
    "The parameter is incorrect" Error Message is displayed on the computer
    http://h10025.www1.HP.com/ewfrf/wc/document?cc=us&LC=en&docName=c03283238

    For the error: "the printer cannot be contacted over the network",
    refer to suggestions provided by Meghmala responded on May 28, 2010.

     
    Hope this solves the problem. If the problem persists, you can write back to us and we will be happy to help you further.
  • Windows cannot access and the bios options are not displayed in the bios options

    Windows cannot access the bios options are not displayed in the bios options, I don't know what the problem is. I've used the laptop and turned on and when I start windows again, there is a usb modem in the usb port (it contains the setup of windows, ubuntu, mac files). That's all that's happened with me, and I get the error in the photos. I have windows 8 x 64 and fujitsu lh532 core i5

    Hello

    Thanks for posting your query in Microsoft Community.

    • Why are you trying to access BIOS?

    In case you have problems with Windows 8, you can come back with more information, and we will be happy to answer your query.

    To access BIOS, we recommend that you contact your computer manufacturer help you make changes in the BIOS.

    Warning: Change BIOS / semiconductor (CMOS) to complementary metal oxide settings can cause serious problems that may prevent your computer from starting properly. Microsoft cannot guarantee that problems resulting from the configuration of the BIOS/CMOS settings can be solved. Changes to settings are at your own risk.

    Hope this information is useful. Please feel free to answer in the case where you are facing in the future other problems with Windows.

  • The event log online help cannot be displayed because the default browser could not be started. Class not registered

    Hello. I live in Brazil, Rio de Janeiro and already installed W8 Pro original Microsoft license.

    When I need to use the event online Help Viewer, a reception this message - the event log online help cannot be displayed because the default browser could not be started.  Class not registered.
    Help, please.
    Thank you
    Carlos.

    Hi Carlos,

    Thanks for posting your query in the Microsoft Community Forums.

    After the description of the question, I understand that you are not able to access the online help for Event Viewer.

    1. do you receive an error message when you try to open the online help for Event Viewer?
    2. who is the default browser on your computer?

    Method 1:


    "The event log online help" her will bring you to the following Web page:

    http://www.Microsoft.com/technet/support/ee/ee_basic.aspx

    I suggest you try to access the above mentioned Web page to see if it works.

    Method 2:

    You can see the article mentioned below for how to set Internet Explorer as default browser.

    Make Internet Explorer your default browser

    http://Windows.Microsoft.com/en-us/Internet-Explorer/make-IE-default-browser#IE=IE-10

    It will be useful. For any other corresponding Windows help, do not hesitate to contact us and we will be happy to help you

Maybe you are looking for