Find the grand parent of child node

Hi gurus,
I have a table with the following structure
Supp_Num     Parent_Num      Inidicator
     1                  Null                    0
     2                    1                      1
     3                    2                      1
     4                  Null                    0
     5                     4                     1
For all the parent Nodes the indicator will have '0'
For all the child Nodes the indicator will have '1'.
I want to write a sQL code where i provide a child name and it traces back to its root parent . For eg if i provide the procedure with Supp_Num=3 it should traverse back to 1 and give 1 as output
Thanks in advance

9ba2a86d-5f7e-4e53-99ee-d675435c2efd wrote:
Thanks for the reply but i'm expecting Supp_Num =4 as well since its parent for Supp_num=5 . Also i want to write it in a Stored Proc form where i just provide the
Supp_num as input and i get the root parent node as output.
Thanks in advance
You wrote in your original post
I want to write a sQL code where i provide a child name and it traces back to its root parent . For eg if i provide the procedure with Supp_Num=3 it should traverse back to 1 and give 1 as output
And my solution did exactly the same. Now if you want the Root details for SUPP_NUM=5, it will provide the root node for same. See below:
with data as
  select 1 supp_num, null par_num, 0 ind from dual union all
  select 2 supp_num, 1 par_num, 1 ind from dual union all
  select 3 supp_num, 2 par_num, 1 ind from dual union all
  select 4 supp_num, null par_num, 0 ind from dual union all
  select 5 supp_num, 4 par_num, 1 ind from dual
select *
  from (
        select supp_num, par_num, ind
          from data
         start with supp_num = 5
        connect by supp_num = prior par_num
where par_num is null;
SUPP_NUM               PAR_NUM                IND                   
4                                             0
You just need to set the START WITH clause with appropriate SUPP_NUM.

Similar Messages

  • How to find the level of each child table in a relational model?

    Earthlings,
    I need your help and I know that, 'yes, we can change'. Change this thread to a answered question.
    So: How to find the level of each child table in a relational model?
    I have a relacional database (9.2), all right?!
         O /* This is a child who makes N references to each of the follow N parent tables (here: three), and so on. */
        /↑\ Fks
       O"O O" <-- level 2 for first table (circle)
      /↑\ Fks
    "o"o"o" <-- level 1 for middle table (circle)
       ↑ Fk
      "º"Tips:
    - each circle represents a table;
    - red tables no have foreign key
    - the table in first line of tree, for example, has level 3, but when 3 becomes N? How much is N? This's the question.
    I started thinking about the following:
    First I have to know how to take the children:
    select distinct child.table_name child
      from all_cons_columns father
      join all_cons_columns child
    using (owner, position)
      join (select child.owner,
                   child.constraint_name fk,
                   child.table_name child,
                   child.r_constraint_name pk,
                   father.table_name father
              from all_constraints father, all_constraints child
             where child.r_owner = father.owner
               and child.r_constraint_name = father.constraint_name
               and father.constraint_type in ('P', 'U')
               and child.constraint_type = 'R'
               and child.owner = 'OWNER') aux
    using (owner)
    where child.constraint_name = aux.fk
       and child.table_name = aux.child
       and father.constraint_name = aux.pk
       and father.table_name = aux.father;Thinking...
    Let's Share!
    My thanks in advance,
    Philips
    Edited by: BluShadow on 01-Apr-2011 15:08
    formatted the code and the hierarchy for readbility

    Justin,
    Understood.
    Nocycle not work in 9.2 and, even that would work, would not be appropriate.
    With your help, I decided a much simpler way (but there is still a small problem, <font color=red>IN RED</font>):
    -- 1
    declare
      type udt_roles is table of varchar2(30) index by pls_integer;
      cRoles udt_roles;
    begin
      execute immediate 'create user philips
        identified by philips';
      select granted_role bulk collect
        into cRoles
        from user_role_privs
       where username = user;
      for i in cRoles.first .. cRoles.count loop
        execute immediate 'grant ' || cRoles(i) || ' to philips';
      end loop;
    end;
    -- 2
    create table philips.root1(root1_id number,
                               constraint root1_id_pk primary key(root1_id)
                               enable);
    grant all on philips.root1 to philips;
    create or replace trigger philips.tgr_root1
       before delete or insert or update on philips.root1
       begin
         null;
       end;
    create table philips.root2(root2_id number,
                               constraint root2_id_pk primary key(root2_id)
                               enable);
    grant all on philips.root2 to philips;
    create or replace trigger philips.tgr_root2
       before delete or insert or update on philips.root2
       begin
         null;
       end;
    create table philips.node1(node1_id number,
                               root1_id number,
                               node2_id number,
                               node4_id number,
                               constraint node1_id_pk primary key(node1_id)
                               enable,
                               constraint n1_r1_id_fk foreign key(root1_id)
                               references philips.root1(root1_id) enable,
                               constraint n1_n2_id_fk foreign key(node2_id)
                               references philips.node2(node2_id) enable,
                               constraint n1_n4_id_fk foreign key(node4_id)
                               references philips.node4(node4_id) enable);
    grant all on philips.node1 to philips;
    create or replace trigger philips.tgr_node1
       before delete or insert or update on philips.node1
       begin
         null;
       end;
    create table philips.node2(node2_id number,
                               root1_id number,
                               node3_id number,
                               constraint node2_id_pk primary key(node2_id)
                               enable,
                               constraint n2_r1_id_fk foreign key(root1_id)
                               references philips.root1(root1_id) enable,
                               constraint n2_n3_id_fk foreign key(node3_id)
                               references philips.node3(node3_id) enable);
    grant all on philips.node2 to philips;
    create or replace trigger philips.tgr_node2
       before delete or insert or update on philips.node2
       begin
         null;
       end;                          
    create table philips.node3(node3_id number,
                               root2_id number,
                               constraint node3_id_pk primary key(node3_id)
                               enable,
                               constraint n3_r2_id_fk foreign key(root2_id)
                               references philips.root2(root2_id) enable);
    grant all on philips.node3 to philips;
    create or replace trigger philips.tgr_node3
       before delete or insert or update on philips.node3
       begin
         null;
       end;                          
    create table philips.node4(node4_id number,
                               node2_id number,
                               constraint node4_id_pk primary key(node4_id)
                               enable,
                               constraint n4_n2_id_fk foreign key(node2_id)
                               references philips.node2(node2_id) enable);
    grant all on philips.node4 to philips;
    create or replace trigger philips.tgr_node4
       before delete or insert or update on philips.node4
       begin
         null;
       end;                          
    -- out of the relational model
    create table philips.node5(node5_id number,
                               constraint node5_id_pk primary key(node5_id)
                               enable);
    grant all on philips.node5 to philips;
    create or replace trigger philips.tgr_node5
       before delete or insert or update on philips.node5
       begin
         null;
       end;
    -- 3
    create table philips.dictionary(table_name varchar2(30));
    insert into philips.dictionary values ('ROOT1');
    insert into philips.dictionary values ('ROOT2');
    insert into philips.dictionary values ('NODE1');
    insert into philips.dictionary values ('NODE2');
    insert into philips.dictionary values ('NODE3');
    insert into philips.dictionary values ('NODE4');
    insert into philips.dictionary values ('NODE5');
    --4
    create or replace package body philips.pck_restore_philips as
      procedure sp_select_tables is
        aExportTablesPhilips     utl_file.file_type := null; -- file to write DDL of tables   
        aExportReferencesPhilips utl_file.file_type := null; -- file to write DDL of references
        aExportIndexesPhilips    utl_file.file_type := null; -- file to write DDL of indexes
        aExportGrantsPhilips     utl_file.file_type := null; -- file to write DDL of grants
        aExportTriggersPhilips   utl_file.file_type := null; -- file to write DDL of triggers
        sDirectory               varchar2(100) := '/app/oracle/admin/tace/utlfile'; -- directory \\bmduhom01or02 
        cTables                  udt_tables; -- collection to store table names for the relational depth
      begin
        -- omits all referential constraints:
        dbms_metadata.set_transform_param(dbms_metadata.session_transform, 'REF_CONSTRAINTS', false);
        -- omits segment attributes (physical attributes, storage attributes, tablespace, logging):
        dbms_metadata.set_transform_param(dbms_metadata.session_transform, 'SEGMENT_ATTRIBUTES', false);
        -- append a SQL terminator (; or /) to each DDL statement:
        dbms_metadata.set_transform_param(dbms_metadata.session_transform, 'SQLTERMINATOR', true);
        -- create/open files for export DDL:
        aExportTablesPhilips := utl_file.fopen(sDirectory, 'DDLTablesPhilips.pdc', 'w', 32767);
        aExportReferencesPhilips := utl_file.fopen(sDirectory, 'DDLReferencesPhilips.pdc', 'w', 32767);
        aExportIndexesPhilips := utl_file.fopen(sDirectory, 'DDLIndexesPhilips.pdc', 'w', 32767);
        aExportGrantsPhilips := utl_file.fopen(sDirectory, 'DDLGrantsPhilips.pdc', 'w', 32767);
        aExportTriggersPhilips := utl_file.fopen(sDirectory, 'DDLTriggersPhilips.pdc', 'w', 32767);
        select d.table_name bulk collect
          into cTables -- collection with the names of tables in the schema philips
          from all_tables t, philips.dictionary d
         where owner = 'PHILIPS'
           and t.table_name = d.table_name;
        -- execution
        sp_seeks_ddl(aExportTablesPhilips,
                     aExportReferencesPhilips,
                     aExportIndexesPhilips,
                     aExportGrantsPhilips,
                     aExportTriggersPhilips,
                     cTables);
        -- closes all files
        utl_file.fclose_all;
      end sp_select_tables;
      procedure sp_seeks_ddl(aExportTablesPhilips     in utl_file.file_type,
                             aExportReferencesPhilips in utl_file.file_type,
                             aExportIndexesPhilips    in utl_file.file_type,
                             aExportGrantsPhilips     in utl_file.file_type,
                             aExportTriggersPhilips   in utl_file.file_type,
                             cTables                  in out nocopy udt_tables) is
        cDDL       clob := null; -- colletion to save DDL
        plIndex    pls_integer := null;
        sTableName varchar(30) := null;
      begin
        for i in cTables.first .. cTables.count loop
          plIndex    := i;
          sTableName := cTables(plIndex);
           * Retrieves the DDL and the dependent DDL into cDDL clob       *      
          * for the selected table in the collection, and writes to file.*
          begin
            cDDL := dbms_metadata.get_ddl('TABLE', sTableName, 'PHILIPS');
            sp_writes_ddl(aExportTablesPHILIPS, cDDL);
          exception
            when dbms_metadata.object_not_found then
              null;
          end;
          begin
            cDDL := dbms_metadata.get_dependent_ddl('REF_CONSTRAINT', sTableName, 'PHILIPS');
            sp_writes_ddl(aExportReferencesPhilips, cDDL);
          exception
            when dbms_metadata.object_not_found2 then
              null;
          end;
          begin
            cDDL := dbms_metadata.get_dependent_ddl('INDEX', sTableName, 'PHILIPS');
            sp_writes_ddl(aExportIndexesPhilips, cDDL);
          exception
            when dbms_metadata.object_not_found2 then
              null;
          end;
          begin
            cDDL := dbms_metadata.get_dependent_ddl('OBJECT_GRANT', sTableName, 'PHILIPS');
            sp_writes_ddl(aExportGrantsPhilips, cDDL);
          exception
            when dbms_metadata.object_not_found2 then
              null;
          end;
          begin
            cDDL := dbms_metadata.get_dependent_ddl('TRIGGER', sTableName, 'PHILIPS');
            sp_writes_ddl(aExportTriggersPhilips, cDDL);
          exception
            when dbms_metadata.object_not_found2 then
              null;
          end;
        end loop;
      end sp_seeks_ddl;
      procedure sp_writes_ddl(aExport in utl_file.file_type,
                              cDDL    in out nocopy clob) is
        pLengthDDL  pls_integer := length(cDDL);
        plQuotient  pls_integer := null;
        plRemainder pls_integer := null;
      begin
          * Register variables to control the amount of lines needed   *
         * for each DDL and the remaining characters to the last row. *
        select trunc(pLengthDDL / 32766), mod(pLengthDDL, 32766)
          into plQuotient, plRemainder
          from dual;
          * Join DDL in the export file.                            *
         * ps. 32766 characters + 1 character for each line break. *
        -- if the size of the DDL is greater than or equal to limit the line ...
        if plQuotient >= 1 then
          -- loops for substring (lines of 32766 characters + 1 break character):
          for i in 1 .. plQuotient loop
            utl_file.put_line(aExport, substr(cDDL, 1, 32766));
            -- removes the last line, of clob, recorded in the buffer:
            cDDL := substr(cDDL, 32767, length(cDDL) - 32766);
          end loop;
        end if;
          * If any remains or the number of characters is less than the threshold (quotient = 0), *
         * no need to substring.                                                                 *
        if plRemainder > 0 then
          utl_file.put_line(aExport, cDDL);
        end if;
        -- record DDL buffered in the export file:
        utl_file.fflush(aExport);
      end sp_writes_ddl;
    begin
      -- executes main procedure:
      sp_select_tables;
    end pck_restore_philips;<font color="red">The problem is that I still have ...
    When creating the primary key index is created and this is repeated in the file indexes.
    How to avoid?</font>

  • Delivery document how to print the BOM Parent and Child items

    Hi,
    I have a production BOM. In Delivery document how to print the Parent and Child items Item Code and Qty.At the time
    of add a delivery document Inventory stock redused only in Parent Item not child item because child item stock already reduced in issue for production.

    If you need to print both the BOM Parent and Child items, you have to create your own report. BOM is only for production if it is not Sales type.
    Thanks,
    Gordon

  • Getting the value of a child node in an array

    How do you get the value of a child node in an array titled "entries"?  I used to do this in AS2, and now I'm trying in AS3.  To top it off, I'm forced to use an XML format I'm unfamiliar with.  So I'm not sure how to access these nodes in AS3.  An example of the XML is;
       <Row>
        <Cell><Data ss:Type="String">Absorption Areas</Data></Cell>
        <Cell><Data ss:Type="String">Drain fields where left over liquid from the septic system soak into the ground.</Data></Cell>
       </Row>
    How would I access ether of the <Cell> rows?
    Thanks

    Given that you declared ss namespace (otherwise it will throw an error) you have two options:
    xml.Cell[0].Data - will output:
    Absorption Areas
    xml.Cell.Data will output:
    <Data ss:Type="String">Absorption Areas</Data>
    <Data ss:Type="String">Drain fields where left over liquid from the septic system soak into the ground.</Data>
    So, xml.Cell.Data[1] will output:
    Drain fields where left over liquid from the septic system soak into the ground.

  • Programmatic, using bean add Parent and child nodes in af:tree dynamically

    Hi All,
    i have to add parent and child nodes dynamically in tree .
    Example :
    i have created a tree like below.On click of button i will get value A ,from pl/sql function i will A1 and A 2 values.which i have to show in pop as tree.
    A
    |-----A1
    |-----A2
    If user clicks on A2.I have to catch A2 value and pass to pl/sql function which gives A2.01 and A2.02 values.
    A
    |-----A1
    |-----A2
    |------A2.01
    |------A2.02.
    A, A1 ,A2,A2.01 ...........values comes from pl/sql funchtion .
    thanks in advance ......... any suggestion will greatly helps

    no use ......................

  • How to differentiate parent and child node in af:treeTable ?

    Greetings,
    I have a requirement, I display master child view objects using <af:treeTable> component, When user expands a parent row, I have to make parent row is in read only and expanded(child) row in editable. To accomplish this I have to identify the 'node' whether it belongs to parent or child view object. In this example Tree table binds with EmpVO, There is a view link beteween EmpVO and DepartmentVO.
    <af:treeTable value="#{bindings.EmpVO.treeModel}"
    var="node"
    rowSelection="single" id="tEqSum"
    summary="Employee Summary"
    <af:column sortProperty="#{bindings.EmpVO.hints.LocCity.name}"
    filterable="true" sortable="true" width="90"
    headerText="#{bindings.EmpVO.hints.LocCity.label}"
    id="c3">
    <af:outputText value="#{node.LocCity}" id="ot21"/>
    expandAllEnabled="false">
    </af:treeTable>
    Thanks in Advance,

    Hi,
    You can find out the node depth by using
    #{bindings.<your_tree_binding>.treeModel.depth}Based on the depth, you can decide whether its a parent node or child node (for a 1 level tree- say dept and emp, the depth for parent would be 0 and for the child it would be 1).
    -Arun

  • How to call the grand parent constructor from the child ??

    Hi All,
    I am having 3 classes.
    Class A.
    Class B extends Class A.
    Class C extends Class A
    i need to call the constructor of ClassA from Class C. how to call ??
    Thanks,
    J.Kathir

    Each class will implicitly call the parent default constructor if you do not call it in the code ie
    super();However you can call any of the parent constructors ie
    class Parent {
        int value;
        Parent(int v) {
            value = v;
        public void display() {
            System.out.println(value);
    class Child extends Parent {
        Child(int v) {
            super(v);
        public static void main(String[] args) {
            Child c = new Child(10);
            c.display();
    }

  • Abap mapping: remove a parent or child node.

    Hi all,
    I will trying to remove a parent node (and all childs related to it) or a specific child (field) om my XML input message to obtain a new output message.
    Reading the meaning of the methods remove_node and remove child (if_ixml_node) I can not find a solution in writing the right Abap code.
    My ouput document is so defined:
    data: outcode type ref to if_ixml_node.
    I receive the following error message when I try to find all possibilities.
    Runtime Errors         OBJECTS_OBJREF_NOT_ASSIGNED_NO
    If someone can give me a simple code for solving my issue, I will appreciate this.
    Thanks,
    Regards,
       Giovanni

    Hi,
    this link explain the signature that is how to use all the methods  including the method u want
    [http://help.sap.com/saphelp_nw04/helpdata/en/bb/57669ddca511d4990b00508b6b8b11/frameset.htm]
    and this for complete library for ABAP mapping[http://help.sap.com/saphelp_nw04/helpdata/en/bb/57669ddca511d4990b00508b6b8b11/frameset.htm]
    Thanks and regards,
    Kubra Fatima.

  • Problem while handling Parent and child nodes in CE

    Hi all
    I am facing a problem with handling Child and Parent nodes in CE.
    I have a Table in which I have drop downs. On selecting a value in the drop down, I have to take that value and do some action.
    I am trying to access the value in the following ways
    wdContext.nodeParent().currentParentElement().nodeChild().currentChildElement().getVaActivity();
    wdContext.nodeChild ().currentChildElement().getVaActivity();
    When I select the drop down from the first row of the Table the code works fine.
    But when I select other rows, it returns the current value of the first row.
    The lead selection of the parent always returns u20180u2019 even though you have done some action in row 2,3 etc.
    The same code gives the required values in EP 7.0; I.e.: it returns the values form selected row in the table.
    Basic problem is that the current value of parent always returns the first row.
    Following are the Properties of the nodes
    Parent
    Collection Cardinality: 0-n
    Singletone: true
    Child:
    Collection Cardinality: 0-n
    Singletone: false
    Please help
    Regards
    Deepu

    Hi,
       In CE changing dropdown selections doesn't fire table leadselection events. If you want to use a dropdown in a context-driven UI element like a Table, you need to use of event parameter mappings. So here are the steps:
    1. Create a new action for the onSelect event of the dropdown (I will write the code for DropDownByIndex), let's call it Select.
    2. Add a parameter parentElement whose type is same as the type of the parent node element. So from your example it would be IParentElement. Select the chek-box for "Adapt event-handler parameter". This will add a new parameter to the event-handler method onActionSelect called parentElement.
    3. Write this inside wdDoModifyView :
    if (firstTime) {
        IWDAbstractDropDownByIndex ddi = (IWDAbstractDropDownByIndex) view.getElement("<id of DropDownByIndex>");
        ddi.mappingOfOnSelect().addSourceMapping(IWDAbstractDropDownByIndex.IWDOnSelect.NODE_ELEMENT,"parentElement");
    3. If you want to set the lead selection of the table to the row where the dropdown is write this inside the event-handler:
    wdContext.nodeParent().setLeadSelection(parentElement.index()); //parentElement is the event handler parameter added through the action.
    Note that the event parameter IWDOnSelect.NODE_ELEMENT points to the node element that defines the data mapping for the containing row and not the node element of the source for the dropdown. This has been specfically  added for such a scenario. All this is well documented [here|http://help.sap.com/javadocs/nwce/current/wdr/com/sap/tc/webdynpro/clientserver/uielib/standard/api/IWDAbstractDropDownByIndex.IWDOnSelect.html#NODE_ELEMENT].
    Regards,
    Satyajit.

  • How to process the data in a child node

    Hi Guru,
    would like to knows is that a way or best practice to process the child notes data? This is my case.
    request input will have this structure.
    <To>
    <Email>[email protected]</Email>
    <Email>[email protected]</Email>
    </To>
    <From>David</From>
    from the above schema i will need to use the email add to invoke some DB process and get the user details. Any idea how can I get each of the nodes and process it. Sorry i am still new in XML.
    In my mind is to loop the TO element but how? Thanks in advance

    something like that :
    <while name="While_1" condition="bpws:getVariableData('varIndex') < ora:countNodes('inputVariable','payload','/client:To/client:Email') + 1">
    <assign>
    - first copy rule
    varTemp = concat(bpws:getVariableData('varTemp','payload','/client:emailCollection')," ",bpws:getVariableData('inputVariable','payload','/client:To/client:Email[position() = bpws:getVariableData('varIndex')]'))
    -second copy rule
    bpws:getVariableData('varIndex') = bpws:getVariableData('varIndex') + 1
    </asign>
    </while>

  • Finding the highest parent...

    Hi Guys,
    I have two tables.
    First table is tblTeam:
    Team_ID ~ Team_Name
    1 ~ Overall Accounting Group
    2 ~ Accounting - USA
    3 ~ Accounting - Europe
    4 ~ Accounting - Texas
    5 ~ Accounting - NYC
    6 ~ Accounting - London
    7 ~ Accounting - Dublin
    The second table is the relationship table, tblTeamRel. It has 2 one to many relationships with tblTeam, a parent and a child relationship:
    Parent_Team_ID ~ Child_Team_ID
    1 ~ 2
    1 ~ 3
    2 ~ 4
    2 ~ 5
    3 ~ 6
    3 ~ 7
    I want to write a query where you give the a team_ID and you get its highest team_ID back, for example:
    I enter team_ID 7 (Accounting - Dublin) and it returns team_id 1 (Overall Accounting Group)
    or I enter team_ID 2 (Accounting - USA) and it returns team_id 1 (Overall Accounting Group)
    Im not sure where to start with this query so any examples you can show me or any help you can give me would be greatly appreciated...
    Thanks,
    Sean
    Edited by: Hazy on May 14, 2010 1:35 PM

    Maybe something like this?
    SQL> var childTeam NUMBER;
    SQL>
    SQL> exec :childTeam := 7;
    PL/SQL procedure successfully completed.
    SQL> WITH tblTeam AS
      2  (
      3          SELECT 1 AS TEAM_ID, 'Overall Accounting Group' AS TEAM_NAME FROM DUAL UNION ALL
      4          SELECT 2 AS TEAM_ID, 'Accounting - USA' AS TEAM_NAME FROM DUAL UNION ALL
      5          SELECT 3 AS TEAM_ID, 'Accounting - Europe' AS TEAM_NAME FROM DUAL UNION ALL
      6          SELECT 4 AS TEAM_ID, 'Accounting - Texas' AS TEAM_NAME FROM DUAL UNION ALL
      7          SELECT 5 AS TEAM_ID, 'Accounting - NYC' AS TEAM_NAME FROM DUAL UNION ALL
      8          SELECT 6 AS TEAM_ID, 'Accounting - London' AS TEAM_NAME FROM DUAL UNION ALL
      9          SELECT 7 AS TEAM_ID, 'Accounting - Dublin' AS TEAM_NAME FROM DUAL
    10  ), tblTeamRel AS
    11  (
    12          SELECT 1 AS PARENT_TEAM_ID, 2 AS LD_PARENT_ID FROM DUAL UNION ALL
    13          SELECT 1 AS PARENT_TEAM_ID, 3 AS LD_PARENT_ID FROM DUAL UNION ALL
    14          SELECT 2 AS PARENT_TEAM_ID, 4 AS LD_PARENT_ID FROM DUAL UNION ALL
    15          SELECT 2 AS PARENT_TEAM_ID, 5 AS LD_PARENT_ID FROM DUAL UNION ALL
    16          SELECT 3 AS PARENT_TEAM_ID, 6 AS LD_PARENT_ID FROM DUAL UNION ALL
    17          SELECT 3 AS PARENT_TEAM_ID, 7 AS LD_PARENT_ID FROM DUAL
    18  )
    19  /* END SAMPLE DATA */
    20  SELECT  parent_team_id
    21  ,       team_name
    22  FROM    tblTeam
    23  JOIN    tblTeamRel ON tblTeam.team_id = tblTeamRel.parent_team_id
    24  WHERE CONNECT_BY_ISLEAF = 1
    25  START WITH ld_parent_id = :childTeam
    26  CONNECT BY PRIOR  parent_team_id = ld_parent_id
    27  /
          PARENT_TEAM_ID TEAM_NAME
                       1 Overall Accounting Group
    SQL> exec :childTeam := 2;
    PL/SQL procedure successfully completed.
    SQL> /
          PARENT_TEAM_ID TEAM_NAME
                       1 Overall Accounting GroupIn the future you'd probably get a faster response in the {forum:id=75} forum.
    Additionally, it's always helpful to provide the following:
    1. Oracle version (SELECT * FROM V$VERSION)
    2. Sample data in the form of CREATE / INSERT statements.
    3. Expected output
    4. Explanation of expected output (A.K.A. "business logic")
    5. Use \ tags for #2 and #3. See FAQ (Link on top right side) for details.
    You provided #3 and #4. You kind of provided #2 but not in a usable form.
    Edited by: Centinul on May 14, 2010 1:23 PM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Don't see parent and child nodes in tree control with switcher, enclose xml

    Hi, i.m a novice for jdev 11.1.1.2,
    i need to create a tree menu, but when i put the switcher + n°2 face whith link object, inside the tree and
    run my application i don't see the node, but i see the bookmarks that collapease and expand Why ????
    Thanks for your help
    Gio
    enclose xml for better clarification:
    <?xml version='1.0' encoding='UTF-8'?>
    <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:af="http://xmlns.oracle.com/adf/faces/rich">
    <jsp:directive.page contentType="text/html;charset=UTF-8"/>
    <f:view>
    <af:document id="d1">
    <af:messages id="m1"/>
    <af:form id="f1">
    <af:panelStretchLayout id="psl1">
    <f:facet name="center">
    <af:panelGroupLayout layout="scroll"
    xmlns:af="http://xmlns.oracle.com/adf/faces/rich"
    id="pgl4">
    <af:panelSplitter id="ps1" splitterPosition="156"
    inlineStyle="width:534px;">
    <f:facet name="first">
    <af:panelGroupLayout layout="scroll"
    xmlns:af="http://xmlns.oracle.com/adf/faces/rich"
    id="pgl3">
    <af:panelHeader text="panelHeader 1" id="ph1">
    <f:facet name="context"/>
    <f:facet name="menuBar"/>
    <f:facet name="toolbar"/>
    <f:facet name="legend"/>
    <f:facet name="info"/>
    <af:tree value="#{bindings.DepartmentsViewTree.treeModel}"
    selectionListener="#{bindings.DepartmentsViewTree.treeModel.makeCurrent}"
    rowSelection="single" id="t1" var="node">
    <f:facet name="nodeStamp">
    <af:switcher id="s1"
    facetName="#{node.hierType.viewDefName}">
    <f:facet name="DepartmentsView">
    <af:panelGroupLayout id="pgl1">
    <af:commandLink text="#{node}"
    action="#{MainPageBean.departmentRegionLayout}"
    id="cl1">
    <af:setActionListener from="#{node.DepartmentId}"
    to="#{pageFlowScope.TreeKey}"/>
    </af:commandLink>
    <af:commandLink text=" (Edit)"
    action="createEdit" id="cl2">
    <af:setActionListener from="#{node.DepartmentId}"
    to="#{pageFlowScope.DeptTreeKey}"/>
    </af:commandLink>
    </af:panelGroupLayout>
    </f:facet>
    <f:facet name="EmployeesView">
    <af:commandLink text="#{node}"
    action="#{MainPageBean.employeeRegionLayout}"
    id="cl3">
    <af:setActionListener from="#{node.EmployeeId}"
    to="#{pageFlowScope.TreeKey}"/>
    </af:commandLink>
    </f:facet>
    </af:switcher>
    </f:facet>
    </af:tree>
    </af:panelHeader>
    </af:panelGroupLayout>
    </f:facet>
    <f:facet name="second">
    <af:panelGroupLayout layout="scroll"
    xmlns:af="http://xmlns.oracle.com/adf/faces/rich"
    id="pgl2">
    <af:region value="#{bindings.dynamicRegion1.regionModel}"
    id="dynam1" partialTriggers="::t1"/>
    </af:panelGroupLayout>
    </f:facet>
    </af:panelSplitter>
    </af:panelGroupLayout>
    <!-- id="af_one_column_stretched" -->
    </f:facet>
    </af:panelStretchLayout>
    </af:form>
    </af:document>
    </f:view>
    </jsp:root>
    Edited by: user595664 on 5-dic-2009 2.54
    Edited by: user595664 on 5-dic-2009 2.57

    Hi,
    you need to provide the full naming for the facet names. So instead of DepartmentsView you provide mypackage.DepartmentsView where you replace mypackage with the package structure of the the ViewObject
    Frank

  • How to identify the current lead selection is child or parent in rec node

    Hi
    I am using a recursive node to populate a table with TreeByNestingTableColumn as master column. Now my problem is how do I identify if the current selected row in the table is a child or parent? When I get the lead selection value, I find that its the same for the parent and the child. I am setting the isLeaf and hasChildren boolean properties appropriately as false and true for parent and true and false for child. But since the lead selection is returning the same the below rsTableElement always gives me the parent, I always get those parameter values as that of parent. I am writing this inside the onleadSelect event of the table.
    IRsTableElement rsTableElement = (IRsTableElement) wdContext.nodeRsTable().getElementAt(wdContext.nodeRsTable().getLeadSelection());
    In this scenario how do I know if the current selection is made on a child?
    Appreciate for all help and any code snippets.
    Thanks,
    KN.

    Hi KN,
    I guess you want to check if the node that you selected is parent or child.. This can be achieved by using getTreeSelection() method of IWDNode.
    If you write following code in your lead selection action, you can determine the if it is a parent or child node.
    wdComponentAPI.getMessageManager().reportSuccess(wdContext.nodeRsTable().getTreeSelection() +"");
    the output will be something like
    <ViewName>.RsTable.0.ChildRsTable.1.ChildRsTable.0.. depending upon which node you have selected.
    That way you can find out if it is a parent or child node.
    Abhinav

  • How to set the horisontal offset for a node relative its parent in JTree?

    When using large icons for nodes in a JTree the whole tree looks very compact. I found a method setRowHeight(int height) to set the row height that got med some space between the rows. But I couldn't find a simular method to increase the offset between a child node and its parent.
    Any suggestions?

    You can control the offset through the BasicTreeUI, as discussed in this thread:
    http://forum.java.sun.com/thread.jspa?threadID=630707&messageID=3636590
    See reply #8 and #9.

  • Moving child node's parent in JTree

    hi guys.
    What i have is a Jtree dynamically generated, im trying to re-arrange the nodes inside.
    each nodes and their parents have their own values and been built with DefaultMutableTreeNode.
    So im thinking, to do so i first need to analyse which child node i want to move, then remove it from its current parent, then set the new parent to this node.
    I been thinking of using the values and compare them to do the parent-node matching, however, i have been looking at the APIs without luck, for methods to possible retrieve the values of the childs/parents.
    Or perhaps there is a simpler way,
    Does anybody have a clue where i could find some answers to this problem?
    Cheers, Eric.

    aiwick wrote:
    hi guys.
    What i have is a Jtree dynamically generated, im trying to re-arrange the nodes inside.
    each nodes and their parents have their own values and been built with DefaultMutableTreeNode.
    So im thinking, to do so i first need to analyse which child node i want to move, then remove it from its current parent, then set the new parent to this node.
    I been thinking of using the values and compare them to do the parent-node matching, however, i have been looking at the APIs without luck, for methods to possible retrieve the values of the childs/parents.
    Or perhaps there is a simpler way,
    Does anybody have a clue where i could find some answers to this problem?
    Cheers, Eric.Not sure what the problem is exactly. DefaultMutableTreeNode has methods for retrieving it's parent and child nodes: which is all you need to move nodes in your tree.

Maybe you are looking for

  • Question about memory upgrade on Satellite A210-127

    I upgraded my memory form 2Gb (2x1 Gb) to 4Gb (2x2 Gb) with two Kingston memory modules KVR667D2S5/2G (PC2-5300 CL5). For two weeks there were no problems but then I got blue screen every time when system boots reffering to I guss memory error. I tri

  • Custom Stamps in Acrobat Reader

    I am in an office whereby I am the only person with the full version of Adobe Acrobat. Everyone else only has Acrobat Reader. I've created many a custom stamp for myself to use and I find them very handy, however, I'd like to be able to create custom

  • Sharpening treatment gets lost on export or library mode.

    I use Lightroom 5.5 with Windows 7, RAW-photos imported as dng. If I use sharpening and noise treating in the develop mode I loose my modulation if I go back to library mode. The same problem comes up on exporting the photo. So I can't profit of any

  • "SubReq" is still available in the stock/requirements list.

    Hi SAP guru's,          In the subcontracting scenario for our client, the required quantity of child component will be provided to the subcontracting vendor. For one particular purchase order, Subcontracting PO for parent material "A" - qty 4284 Chi

  • Turning off keychain login

    I just moved from a MacBook Pro to an iMac. In fact, I moved from about 5 years of using a MacBook Pro, which functioned as both a desktop (when attached to a monitor) and a laptop. As part of my security paranoia, I locked the keychain, and required