Complex Tree Structure Query

Hi,
I have a table which contains the hierarchial data upto 4 levels. I needed to have the information of all the four levels in a row, so I created 3 tree structured views and one another view using the tree structured views as below
--To get the great grand parent id for the children*
CREATE OR REPLACE VIEW VR_PO_TREE AS
SELECT LEVEL pathlength,
connect_by_root partner_organization_id root_po,
partner_organization_id,
partner_common_name,
partner_organization_type
FROM partner_organization po
START WITH po.org_entity_above_id IS NULL
CONNECT BY PRIOR po.partner_organization_id = po.org_entity_above_id
ORDER BY po.partner_organization_id;
-- level 2 (grant parent) id
CREATE OR REPLACE VIEW VR_PO_AREA_TR AS
SELECT LEVEL pathlength,
connect_by_root partner_organization_id root_po,
partner_organization_id,
partner_common_name,
partner_organization_type
FROM partner_organization vcpo
START WITH vco.partner_organization_type = 'AREA'
CONNECT BY PRIOR vcpo.partner_organization_id = vcpo.org_entity_above_id
ORDER BY vcpo.partner_organization_id;
--level 3 (parent) id*
CREATE OR REPLACE VIEW VR_PO_REGION_TREE AS
SELECT LEVEL pathlength,
connect_by_root partner_organization_id root_po,
vcpo.partner_organization_id,
vcpo.partner_common_name,
vcpo.partner_type
FROM partner_organization vcpo
START WITH vcpo.partner_organization_type = 'REGION'
CONNECT BY PRIOR vcpo.partner_organization_id = vcpo.org_entity_above_id
ORDER BY vcpo.partner_organization_id;
---and finally created a view to have all the levels in a single row
CREATE OR REPLACE VIEW VR_PO_ALL_TREE AS
SELECT pot.pathlength,
po.partner_organization_id,
po.partner_common_name,
pot.root_po int_partner_org_id,
pot.intl_po_name int_partner_common_name,
vpat.root_po area_partner_org_id,
vpat.area_po_name area_partner_common_name,
vprt.root_po region_partner_org_id,
vprt.region_po_name region_partner_common_name
FROM partner_organization po
JOIN vr_po_tree pot
ON pot.partner_organization_id = po.partner_organization_id
LEFT outer JOIN vr_po_area_tr vpat
ON vpat.partner_organization_id = po.partner_organization_id
LEFT OUTER JOIN vr_po_region_tree vprt
ON vprt.partner_organization_id = po.partner_organization_id;
All the views are working fine, very fast, giving the expected output.
if we make a join to the view vr_po_all_tree in a query that also works fine. However, if we make an outer join to a query that has the join to vr_po_all_tree, Oracle throws an internal error - Ora-00600 internal error codes, arguments [qrctce1], [0],[0],.....
Is the view vr_po_all_tree is cause for this problem?, in such a case can any one help me to rewrite the view with a simple query to give the same results?
Thanks in advance.
Nattu
Edited by: Nattu on Nov 26, 2009 8:25 PM
Edited by: Nattu on Nov 27, 2009 11:48 AM
Edited by: Nattu on Nov 27, 2009 11:55 AM

Hi,
if we make a join to the view vr_po_all_tree in a query that also works fine. However, if we make an outer join to a query that has the join to vr_po_all_tree, Oracle throws an internal error - Ora-00600 internal error codes, arguments [qrctce1], [0],[0],.....
Is the view vr_po_all_tree is cause for this problem?As Sven said, ORA-00600 is the sign of some low-level problem, and you should seek a solution from Oracle support. Your views are not the cause of this problem; most likely, the views trigger something that would not be a problem except for a installatin problem or maybe a bug.
We can try to find a work-around for you, but don't ignore the problem.
in such a case can any one help me to rewrite the view with a simple query to give the same results?It seems very likely that you could do something that didn't involve so many CONNECT BYs and outer joins.
Post some sample data (CREATE TABLE and INSERT statements) and the results you want from that data.
Simplify as much as possible. For example, in the first view you say:
CREATE OR REPLACE VIEW VR_PO_TREE AS
SELECT LEVEL pathlength,
connect_by_root partner_organization_id root_po,
connect_by_root partner_common_name intl_po_name,
connect_by_root is_wbti is_wbti,
connect_by_root is_sil_int is_sil_int,
connect_by_root organization_entity_code int_org_entity_code,
org_entity_above_id, partner_organization_id,
partner_organization_type,
sys_connect_by_path(partner_organization_id, '\') po_path_id,
sys_connect_by_path(partner_common_name, '\') po_path_name
FROM ...That is, you're selecting 1 pseudo-column (LEVEL), 4 CONNECT_BY_ROOTs, 3 plain columns, and 2 SYS_CONNECT_BY_PATHs.
Can you post a problem with just one of each: 1 pseudo-column, 1 CONNECT_BY_ROOT, 1 plain column, and 1 SYS_CONNECT_BY_PATH?  Adding the others later should be easy.
Any information you can give about the data would be helpful.
In particular,
(a) Can org_entity_above be NULL on the same row where partner_organization_type is 'AREA' or 'REGION'?
(b) How many ancestors with partner_organization_type = 'AREA' Can a node have? 1? No more than 1?  1 or more? 0 or more?
(c) Same for 'REGION'.  How many ancestors with partner_organization_type = 'REGION' Can a node have? 1? No more than 1?  1 or more? 0 or more?
(d) Can a node with partner_organization_type = 'REGION' be the ancestor of a row with partner_organization_type = 'AREA'?
(e) Other way around: can a node with partner_organization_type = 'AREA' be the ancestor of a row with partner_organization_type = 'REGION'?
Some of these questions may seem silly to you, because you know the table and the data so well.  I don't, so you'll have to explain things.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

Similar Messages

  • Hierarchy or Tree structure Query

    Hi,
    I have to display each level total amount from the below tables
    We have two tables.
    Table 1 having the all level columns and table 2 having amount for each level
    Below are the table scripts and sample data
    CREATE TABLE LEVEL_TABLE
    LEVEL1 VARCHAR2(50),
    LEVEL2 VARCHAR2(50),
    LEVEL3 VARCHAR2(50),
    LEVEL4 VARCHAR2(50),
    LEVEL5 VARCHAR2(50)
    CREATE TABLE LEVEL_TABLE_AMT
    AMT NUMBER(15),
    LEVEL_VALUE VARCHAR2(50)
    INSERT INTO LEVEL_TABLE VALUES ('LEVEL_1', 'LEVEL_1.1', 'LEVEL_1.1.1', 'LEVEL_1.1.1.1', 'LEVEL_1.1.1.1.1');
    INSERT INTO LEVEL_TABLE VALUES ('LEVEL_1', 'LEVEL_1.1', 'LEVEL_1.1.1', 'LEVEL_1.1.1.1', 'LEVEL_1.1.1.1.2');
    INSERT INTO LEVEL_TABLE VALUES ('LEVEL_1', 'LEVEL_1.1', 'LEVEL_1.1.2', 'LEVEL_1.1.2.1', null);
    INSERT INTO LEVEL_TABLE VALUES ('LEVEL_1', 'LEVEL_1.1', 'LEVEL_1.1.2', 'LEVEL_1.1.2.2', null);
    INSERT INTO LEVEL_TABLE VALUES ('LEVEL_1', 'LEVEL_1.2', 'LEVEL_1.2.1', null, null);
    INSERT INTO LEVEL_TABLE VALUES ('LEVEL_1', 'LEVEL_1.2', 'LEVEL_1.2.2', 'LEVEL_1.2.2.1', null);
    INSERT INTO LEVEL_TABLE VALUES ('LEVEL_1', 'LEVEL_1.3', 'LEVEL_1.3.1', 'LEVEL_1.3.1.1', null);
    INSERT INTO LEVEL_TABLE VALUES ('LEVEL_1', 'LEVEL_1.3', 'LEVEL_1.3.1', 'LEVEL_1.3.1.2', null);
    INSERT INTO LEVEL_TABLE_AMT VALUES (100, 'LEVEL_1.1.1.1.1');
    INSERT INTO LEVEL_TABLE_AMT VALUES (200, 'LEVEL_1.1.1.1.2');
    INSERT INTO LEVEL_TABLE_AMT VALUES (100, 'LEVEL_1.1.2.1');
    INSERT INTO LEVEL_TABLE_AMT VALUES (300, 'LEVEL_1.1.2.2');
    INSERT INTO LEVEL_TABLE_AMT VALUES (100, 'LEVEL_1.2.1');
    INSERT INTO LEVEL_TABLE_AMT VALUES (400, 'LEVEL_1.2.2.1');
    INSERT INTO LEVEL_TABLE_AMT VALUES (100, 'LEVEL_1.3.1.1');
    INSERT INTO LEVEL_TABLE_AMT VALUES (200, 'LEVEL_1.3.1.2');
    COMMIT;
    Output of the Quey should be as below
    LEVEL_1(Amt)
    -- LEVEL_1.1(Amt)
    -- LEVEL_1.1.1(Amt)
    -- LEVEL_1.1.1.1(Amt)
    -- LEVEL_1.1.1.1.1(Amt)
    -- LEVEL_1.1.1.1.2(Amt)
    -- LEVEL_1.1.2(Amt)
    -- LEVEL_1.1.2.1(Amt)
    -- LEVEL_1.1.2.2(Amt)
    -- LEVEL_1.2(Amt)
    -- LEVEL_1.2.1(Amt)
    -- LEVEL_1.2.2(Amt)
    -- LEVEL_1.2.2.1(Amt)
    -- LEVEL_1.3(Amt)
    -- LEVEL_1.3.1(Amt)
    -- LEVEL_1.3.1.1(Amt)
    -- LEVEL_1.3.1.2(Amt)
    Please check and help me to display the query.
    Thanks,
    Pradeep.

    Seems level_table is not needed
    with
    level_table_amt as
    (select 100 amt, 'LEVEL_1.1.1.1.1' level_value from dual union all
    select 200, 'LEVEL_1.1.1.1.2' from dual union all
    select 100, 'LEVEL_1.1.2.1' from dual union all
    select 300, 'LEVEL_1.1.2.2' from dual union all
    select 100, 'LEVEL_1.2.1' from dual union all
    select 400, 'LEVEL_1.2.2.1' from dual union all
    select 100, 'LEVEL_1.3.1.1' from dual union all
    select 200, 'LEVEL_1.3.1.2' from dual
    ancestors(l,amt,list) as
      (select 1,amt,substr(level_value,7) from level_table_amt
       union all
       select l + 1,amt,substr(list,1,instr(list,'.',-1,1) - 1)
         from ancestors
        where instr(list,'.') > 0
    select 'LEVEL_' || list,sum(amt) amt
      from ancestors
    group by list
    order by listRegards
    Etbin
    Edited by: Etbin on 8.3.2012 14:26
    A quick and dirty hierarhical approach
    with
    level_table_amt as
    (select 100 amt, 'LEVEL_1.1.1.1.1' level_value from dual union all
    select 200, 'LEVEL_1.1.1.1.2' from dual union all
    select 100, 'LEVEL_1.1.2.1' from dual union all
    select 300, 'LEVEL_1.1.2.2' from dual union all
    select 100, 'LEVEL_1.2.1' from dual union all
    select 400, 'LEVEL_1.2.2.1' from dual union all
    select 100, 'LEVEL_1.3.1.1' from dual union all
    select 200, 'LEVEL_1.3.1.2' from dual
    select level_value,amount
      from (select 'LEVEL_' || ltrim(ancestor,'.') level_value,sum(amt) amount
              from (select distinct
                           amt,
                           level_value,
                           substr(level_value,1,instr(level_value,'.',-1,level) - 1) ancestor
                      from (select amt,'.' || substr(level_value,7) level_value
                              from level_table_amt
                    connect by level < length(level_value) - length(replace(level_value,'.',''))
             group by ancestor
            union all
            select level_value,amt
              from level_table_amt
    order by level_value

  • Urgent Help:Tree structured query

    Hi,
    My requirement is as follows..
    I have two tables let's say A and B
    Table A has two fileds ID and PARENT_ID
    ID is a primary key and Parent_id is a foreign key to the same tables "ID" field(i.e, parent_id references a.id)
    Table B has 2 fields : status and id
    where ID is a foreign key to table A.id(B.id references A.ID)
    The data in those two tables looks like this
    A
    ID PARENT_ID
    1 2
    2 3
    3 4
    4
    5 6
    6 7
    7
    Table B has ..
    Status id
    Approved 1
    Approved 2
    Now I would like to select all the Approved Ids and all parent_IDs
    So i should get the following result
    id
    1
    2
    3
    4
    Can somebody help me write this query.. this is Kinda urgent Please.
    Thank you

    sql>select * from a;
           ID PARENT_ID
            1         2
            2         3
            3         4
            4
            5         6
            6         7
            7
    7 rows selected.
    sql>select * from b;
    STATUS                                ID
    Approved                               1
    Approved                               2
    2 rows selected.
    sql>select distinct id
      2    from a
      3   start with id in (select id
      4                       from b
      5                      where status = 'Approved')
      6   connect by prior parent_id = id;
           ID
            1
            2
            3
            4
    4 rows selected.

  • How to use ONE query to find out tree structure?

    ID------------upperID----------Name------------------------isFolder
    1------------ 0---------- Folder
    1------------------------------------1
    2------------ 1------------ Folder 1- Sub
    Folder--------------------1
    3------------ 2------------
    Folder1-Item1-A--------------------------0
    4------------ 1------------ Folder 1- Sub
    Item-----------------------0
    Hi all, if I have a table like above to demonstrate the
    folders and item relationship. This structure allows the user to
    create unlimited folders and items.
    Now I would like to use one query to find out the tree
    structure of this table, how could I do the query.
    Any help on this will be highly appreciated!
    Thanks,
    ez

    Also, see this thread:
    http://www.adobe.com/cfusion/webforums/forum/messageview.cfm?forumid=1&catid=7&threadid=12 55788&enterthread=y

  • Query for spesific children in a tree structure

    Hi,
    My data is organized in a tree structure.
    I need a sql statement that returns a parent that
    have a set of children corresponding to some demands.
    I provide a very simplified description of my data, but it covers my problem.
    Can anyone please help me write a select statement that gives me all featureids
    that have a GID attribute with children GNR=123 AND BNR=456?
    Regards
    gv
    create table attributetype( id number, name varchar2(8), parentid number );
    insert into attributetype( id, name ) values ( 1, 'GIDLIST' );
    insert into attributetype( id, name, parentid ) values ( 2, 'GID', 1 );
    insert into attributetype( id, name, parentid ) values( 3, 'GNR', 2 );
    insert into attributetype( id, name, parentid ) values ( 4, 'BNR', 2 );
    create table attribute( featureid number, id number, parentid number, atttypeid number, intvalue number );
    --attributes for feature1
    insert into attribute( featureid, id, parentid, atttypeid ) values( 1, 1, 0, 1 );
    insert into attribute( featureid, id, parentid, atttypeid ) values( 1, 2, 1, 2 );
    insert into attribute( featureid, id, parentid, atttypeid, intvalue ) values( 1, 3, 2, 3, 123 );
    insert into attribute( featureid, id, parentid, atttypeid, intvalue ) values( 1, 4, 2, 4, 456 );
    insert into attribute( featureid, id, parentid, atttypeid ) values( 1, 5, 1, 2 );
    insert into attribute( featureid, id, parentid, atttypeid, intvalue ) values( 1, 6, 5, 3, 12 );
    insert into attribute( featureid, id, parentid, atttypeid, intvalue ) values( 1, 7, 5, 4, 456 );
    --attributes for feature 2
    insert into attribute( featureid, id, parentid, atttypeid ) values( 2, 8, 0, 1 );
    insert into attribute( featureid, id, parentid, atttypeid ) values( 2, 9, 8, 2 );
    insert into attribute( featureid, id, parentid, atttypeid, intvalue ) values( 2, 10, 9, 3, 678 );
    insert into attribute( featureid, id, parentid, atttypeid, intvalue ) values( 2, 11, 9, 4, 456 );
    insert into attribute( featureid, id, parentid, atttypeid ) values( 2, 12, 8, 2 );
    insert into attribute( featureid, id, parentid, atttypeid, intvalue ) values( 2, 13, 12, 3, 876 );
    insert into attribute( featureid, id, parentid, atttypeid, intvalue ) values( 2, 14, 12, 4, 456 );
    commit;
    column name format a15
    select a.featureid featureid, lpad(' ', (level - 1) * 2) || b.name name, a.id attid, a.parentid parentid, a.intvalue
    from attribute a, attributetype b
    where a.atttypeid=b.id
    connect by prior a.id=a.parentid
    start with a.parentid=0;
    FEATUREID NAME ATTID PARENTID INTVALUE
    1 GIDLIST 1 0
    1 GID 2 1
    1 GNR 3 2 123
    1 BNR 4 2 456
    1 GID 5 1
    1 GNR 6 5 12
    1 BNR 7 5 456
    2 GIDLIST 8 0
    2 GID 12 8
    2 GNR 13 12 876
    2 BNR 14 12 456
    2 GID 9 8
    2 GNR 10 9 678
    2 BNR 11 9 456

    Hi,
    Thanks for providing the CREATE TABLE and INSERT statements; that helps a lot.
    You want featureids that meet three criteria:
    (1) there is a GID attribute
    (2) the GID attribute has a GNR child with intvalue=123
    (3) the GID attribute has a BNR child with intvalue=456
    Since you're looking for immediate children, not distant descendants, it's easiest to do this with a non-hierarrchical query that finds one of these criteria, and does EXISTS sub-queries to test for the other two.
    For example:
    WITH aat AS
    ( -- Begin aat: join of attribute and attributetype
         SELECT     a.featureid
         ,     a.id
         ,     a.parentid
         ,     a.intvalue
         ,     t.name
         FROM     attribute     a
         JOIN     attributetype     t     ON     a.atttypeid     = t.id
    ) -- End aat: join of attribute and attributetype
    SELECT DISTINCT     featureid
    FROM     aat     m     -- m for main
    WHERE     name     = 'GID'
    AND     EXISTS     (     -- Begin EXISTS sub-query for GNR=123
              SELECT     NULL
              FROM     aat
              WHERE     parentid     = m.id
              AND     name          = 'GNR'
              AND     intvalue     = 123
              )     -- End EXISTS sub-query for GNR=123
    AND     EXISTS     (     -- Begin EXISTS sub-query for BNR=456
              SELECT     NULL
              FROM     aat
              WHERE     parentid     = m.id
              AND     name          = 'BNR'
              AND     intvalue     = 456
              )     -- End EXISTS sub-query for BNR=456
    ;Alternatively, you could do a three-way self join, and skip the EXISTS sub-queries.
    If you were looking for GNR and BNR descendants, any number of levels below the same GID node, it's easy to modify the query above. Just re-write the EXISTS sub-queries to CONNECT BY queries that "START WITH parentid = m.id".
    It looks like this application will have a lot of use for a view like aat, above. If you don't already have a permanent view like that, you should create one.

  • How to create a form on a tree structured table

    Hi,
    I have a table that is designed to do a tree structure  like:
    Table Name: test
    Fields:
    ID
    ParentID
    Description
    I created a browser (IR) (page 1) that calls a form (page 2)
    The form has the editing fields and at the bottom layer I have a reports region where I display the children records using a query like:
    select * from test where ParentID = :P2_ID
    I need at the region level to add a button to call a form to edit the child record (which is the same table) and when done, to return to the form again but to the parent record.
    How can I do that successfully? Is there any example:?
    Thank you

    Maybe this can help:
    http://apex.oracle.com/pls/otn/f?p=31517:157
    using instead of trigger on a view.
    Denes Kubicek
    http://deneskubicek.blogspot.com/
    http://www.opal-consulting.de/training
    http://apex.oracle.com/pls/otn/f?p=31517:1
    -------------------------------------------------------------------

  • Tree Structure V Linear List

    I am designing a new program and am examining the various data structures that are available for use. This program I am desiging is basically a database, with various attributes of and employee - eg Name, Id, dept etc.
    What are the advantages & disadvantages of using the tree structure to store this data instead of using the standard linear list?
    Many Thanks

    Ok, if you're a programmer or even maybe a software engineer you SHOULD definetly know what the advantages and disadvantages are. Heck, you should even know what the runtime complexity, in standard "Big-Oh" notation, of a search for each structure.
    Ny
    I am designing a new program and am examining the
    various data structures that are available for use.
    This program I am desiging is basically a database,
    with various attributes of and employee - eg Name, Id,
    dept etc.
    What are the advantages & disadvantages of using the
    tree structure to store this data instead of using the
    standard linear list?
    Many Thanks

  • Can we change the Bill/Payment tree structure on Control central page?

    Can we change the Bill/Payment tree structure on Control central page to Bill/Payment Tree containing a single node for all A/R related activities for a specific bill period, in reverse chronological order. Basically the tree should look like
    + Bill - Date: 03-17-2010 Complete
    +++++ CR Note - Date: 05-04-2010 Complete
    ++++++++++ Pay - Date: 05-04-2010 Frozen
    + Bill - Date: 03-17-2010 Complete
    +++++ Pay - Date: 05-04-2010 Frozen
    I have tried changing controlCentralBPTree.xml but if I do that the tree is not expanding its just collapsed I m not able to expand.
    So do I need to change some other file to change the tree structure and look like above?

    Hello CHS.
    I tested your project but to change the label and has not worked.
    I tried running the Application Module and test the ViewCriteria, and show correctly the labels defined in control hint of bind variable.
    Again, I think the component af:query should do the same, but does not work.
    Any Oracle ACE Director some could verify this problem?
    thank you very much

  • Updating data using a tree structure?

    Hi,
    I need to change some hierarchical data and wondered the best way to do it.
    Basically I have a menu table which I query as a tree structure:
    select menu_name, level, option_text, displayed
    from menu_option
    start with menu_name = 'CONTROL' and option_number >= 0
    connect by prior command_line = menu_name
    command line has the next menu in the level, unless its a leaf!
    What I want to do is, if a 'parent' has the displayed flag set to N, change all the children underneath to N as well. Whats the neatest way to do this in PL/SQL or SQL statements?
    Thanks,
    Tracey.

    How about
    update menu_option m1
    set displayed = 'N'
    where exists
    (select 1
    from menu_option m2
    where m2.displayed = 'N'
    start with m2.menu_name = m1.menu_name
    connect by prior m2.menu_name = m2.command_line)

  • ....Tree structure problem

    Hi all
    i am able to populate a tree structure.
    The Root Nodes displays the Name of the Employees and each roots childs display 2nd level root named, New Request recieved, Cancelled requests.
    Now i want is that whenever the application runs, only the employee should expand its own Node. and if it clicks the node of other employeess , their Node should not Expand. ...
    I dont know how to do that ..
    i know there is a trigger when node expand, but i dont know how to use the check...
    I mean suppose
    x:=Get_application_property(USERNAME);
    if :NODE_Label <> x then
    msg ('''dont open in others mail box');
    Raise Form trigger Failure
    end if
    Is this code ok..
    kindly reply ..
    thnx alot

    I assume you're creating the tree with a 'connect by' query, so why not just use the query to filter out the nodes you don't want to be viewed?
    Eg, table ee with this data (I use ¬ as my null indidcator):
    SQL> SELECT * FROM ee;
    A          B
    ¬          BOB
    ¬          JACK
    ¬          TOM
    BOB        New
    JACK       New
    TOM        New
    BOB        Cancelled
    JACK       Cancelled
    TOM        Cancelled
    9 rows selected.Selecting all rows hierarchically:
    SQL> SELECT LPad(' ',(level - 1) * 4,' ')||b
      2  FROM ee
      3  CONNECT BY PRIOR b = a
      4  START WITH a IS NULL;
    LPAD('',(LEVEL-1)*4,'')||B
    BOB
        New
        Cancelled
    JACK
        New
        Cancelled
    TOM
        New
        Cancelled
    9 rows selected.Selecting child nodes for BOB and no other:
    SQL> SELECT LPad(' ',(level - 1) * 4,' ')||b
      2  FROM ee
      3  WHERE a = 'BOB' OR a IS NULL
      4  CONNECT BY PRIOR b = a
      5  START WITH a IS NULL;
    LPAD('',(LEVEL-1)*4,'')||B
    BOB
        New
        Cancelled
    JACK
    TOM
    SQL>

  • How to create a tree structure using forms.

    Hi,
    How do i create a tree structure using oracle forms,i have a table named Functions and a specific column 'Function Name' should be displayed in the tree nodes.Can anyone help me out on how to create a tree structure and populating the nodes??
    thanks in advance
    Regards
    Karthik

    The FTree package provides functions to populate the tree - look for the topic "Manipulating a hierarchical tree at runtime
    " in the online help this point to all the functions and triggers

  • How to show alv report in tree structure

    hi all,
    how to show data or create a alv report in tree structure.
    thanks in advance.
    Harsha

    Hi Harsha,
    Its done using FM 'RS_TREE_CONSTRUCT'
    and FM for displaying the tree:  'RS_TREE_LIST_DISPLAY'
    Thanks
    Shrila

  • How to get Text for nodes in Tree Structure

    Hi Friends,
    How to get Text for nodes in Tree Structure
    REPORT  YFIIN_REP_TREE_STRUCTURE  no standard page heading.
                       I N I T I A L I Z A T I O N
    INITIALIZATION.
    AUTHORITY-CHECK OBJECT 'ZPRCHK_NEW' :
                      ID 'YFIINICD' FIELD SY-TCODE.
      IF SY-SUBRC NE 0.
        MESSAGE I000(yFI02) with SY-TCODE .
        LEAVE PROGRAM.
      ENDIF.
    class screen_init definition create private.
    Public section
      public section.
        class-methods init_screen.
        methods constructor.
    Private section
      private section.
        data: container1 type ref to cl_gui_custom_container,
              container2 type ref to cl_gui_custom_container,
              tree type ref to cl_gui_simple_tree.
        methods: fill_tree.
    endclass.
    Class for Handling Events
    class screen_handler definition.
    Public section
      public section.
        methods: constructor importing container
                   type ref to cl_gui_custom_container,
                 handle_node_double_click
                   for event node_double_click
                   of cl_gui_simple_tree
                   importing node_key .
    Private section
      private section.
    endclass.
    *&                        Classes implementation
    class screen_init implementation.
    *&                        Method INIT_SCREEN
      method init_screen.
        data screen type ref to screen_init.
        create object screen.
      endmethod.
    *&                        Method CONSTRUCTOR
      method constructor.
        data: events type cntl_simple_events,
              event like line of events,
              event_handler type ref to screen_handler.
        create object: container1 exporting container_name = 'CUSTOM_1',
                       tree exporting parent = container1
                         node_selection_mode =
                cl_gui_simple_tree=>node_sel_mode_multiple.
        create object: container2 exporting container_name = 'CUSTOM_2',
        event_handler exporting container = container2.
    event-eventid = cl_gui_simple_tree=>eventid_node_double_click.
        event-appl_event = ' '.   "system event, does not trigger PAI
        append event to events.
        call method tree->set_registered_events
             exporting events = events.
        set handler event_handler->handle_node_double_click for tree.
         call method: me->fill_tree.
      endmethod.
    *&                        Method FILL_TREE
      method fill_tree.
        data: node_table type table of abdemonode,
              node type abdemonode.
    types:    begin of tree_node,
              folder(50) type c,
              tcode(60) type c,
              tcode1(60) type c,
              tcode2(60) type c,
              text(60) type c,
              text1(60) type c,
              text2(60) type c,
              end of tree_node.
      data:  wa_tree_node type tree_node,
                t_tree_node type table of tree_node.
    wa_tree_node-folder = text-001.
    wa_tree_node-tcode  = text-002.
    wa_tree_node-text =  'Creditors ageing'.
    wa_tree_node-tcode1 = text-003.
    wa_tree_node-text1 =  'GR/IR aging'.
    wa_tree_node-tcode2 = text-004.
    wa_tree_node-text2 =  'Bank Balance'.
    append wa_tree_node to t_tree_node.
    clear wa_tree_node .
    wa_tree_node-folder = text-005.
    wa_tree_node-tcode  = text-006.
    wa_tree_node-text =  'Creditors ageing'.
    wa_tree_node-tcode1 = text-007.
    wa_tree_node-text1 =  'Creditors ageing'.
    wa_tree_node-tcode2 = text-008.
    wa_tree_node-text2 =  'Creditors ageing'.
    append wa_tree_node to t_tree_node.
    clear wa_tree_node .
    wa_tree_node-folder = text-009.
    wa_tree_node-tcode  = text-010.
    wa_tree_node-text =  'Creditors ageing'.
    wa_tree_node-tcode1 = text-011.
    wa_tree_node-text1 =  'Creditors ageing'.
    wa_tree_node-tcode2 = text-012.
    wa_tree_node-text2 =  'Creditors ageing'.
    append wa_tree_node to t_tree_node.
    clear wa_tree_node .
    node-hidden = ' '.                 " All nodes are visible,
        node-disabled = ' '.               " selectable,
        node-isfolder = 'X'.                                    " a folder,
        node-expander = ' '.               " have no '+' sign forexpansion.
        loop at t_tree_node into wa_tree_node.
          at new folder.
            node-isfolder = 'X'.                      " a folder,
            node-node_key = wa_tree_node-folder.
                   clear node-relatkey.
            clear node-relatship.
            node-text = wa_tree_node-folder.
            node-n_image =   ' '.
            node-exp_image = ' '.
            append node to node_table.
          endat.
         at new tcode .
            node-isfolder = ' '.                          " a folder,
            node-n_image =   '@CS@'.       "AV is the internal code
            node-exp_image = '@CS@'.       "for an airplane icon
            node-node_key = wa_tree_node-tcode.
             node-text = wa_tree_node-text .
                     node-relatkey = wa_tree_node-folder.
            node-relatship = cl_gui_simple_tree=>relat_last_child.
          endat.
          append node to node_table.
        at new tcode1 .
            node-isfolder = ' '.                          " a folder,
            node-n_image =   '@CS@'.       "AV is the internal code
            node-exp_image = '@CS@'.       "for an airplane icon
            node-node_key = wa_tree_node-tcode1.
                     node-relatkey = wa_tree_node-folder.
            node-relatship = cl_gui_simple_tree=>relat_last_child.
              node-text = wa_tree_node-text1.
         endat.
          append node to node_table.
           at new tcode2 .
            node-isfolder = ' '.                          " a folder,
            node-n_image =   '@CS@'.       "AV is the internal code
            node-exp_image = '@CS@'.       "for an airplane icon
            node-node_key = wa_tree_node-tcode2.
                     node-relatkey = wa_tree_node-folder.
            node-relatship = cl_gui_simple_tree=>relat_last_child.
            node-text = wa_tree_node-text2.
         endat.
          append node to node_table.
        endloop.
        call method tree->add_nodes
             exporting table_structure_name = 'ABDEMONODE'
                       node_table = node_table.
      endmethod.
    endclass.
    *&                        Class implementation
    class screen_handler implementation.
    *&                        Method CONSTRUCTOR
      method constructor.
       create object: HTML_VIEWER exporting PARENT = CONTAINER,
                      LIST_VIEWER exporting I_PARENT = CONTAINER.
      endmethod.
    *&                 Method HANDLE_NODE_DOUBLE_CLICK
      method handle_node_double_click.
      case node_key(12).
    when 'Creditors'.
    submit YFIIN_REP_CREADITORS_AGING  via selection-screen and return.
    when  'Vendor'.
    submit YFIIN_REP_VENDOR_OUTSTANDING  via selection-screen and return.
    when 'Customer'.
    submit YFIIN_REP_CUSTOMER_OUTSTANDING  via selection-screen and
    return.
    when 'GR/IR'.
    submit YFIIN_REP_GRIR_AGING  via selection-screen and return.
    when 'Acc_Doc_List'.
    submit YFIIN_REP_ACCOUNTINGDOCLIST  via selection-screen and return.
    when 'Bank Bal'.
    submit YFIIN_REP_BANKBALANCE  via selection-screen and return.
    when 'Ven_Cus_Dtl'.
    submit YFIIN_REP_VENDORCUST_DETAIL via selection-screen and return.
    when 'G/L_Open_Bal'.
    submit YFIIN_REP_OPENINGBALANCE via selection-screen and return.
    when 'Usr_Authn'.
    submit YFIIN_REP_USERAUTHRIZATION via selection-screen and return.
    endcase.
      endmethod.
    endclass.
    Program execution ************************************************
    load-of-program.
      call screen 9001.
    at selection-screen.
    Dialog Modules PBO
    *&      Module  STATUS_9001  OUTPUT
          text
    module status_9001 output.
      set pf-status 'SCREEN_9001'.
      set titlebar 'TIT_9001'.
      call method screen_init=>init_screen.
    endmodule.                 " STATUS_9001  OUTPUT
    Dialog Modules PAI
    *&      Module  USER_COMMAND_9001  INPUT
          text
    module user_command_9001 input.
    endmodule.                 " USER_COMMAND_9001  INPUT
    *&      Module  exit_9001  INPUT
          text
    module exit_9001 input.
    case sy-ucomm.
    when 'EXIT'.
      set screen 0.
    endcase.
    endmodule.
            exit_9001  INPUT

    you can read  the table node_table with nody key value which imports when docubble click the the tree node (Double clifk event).
    Regards,
    Gopi .
    Reward points if helpfull.

  • How to create Tree structure in Visual Composer

    Hi All,
         I need to develop tree structure in my VC application. Can any one of you please suggest me the steps to do it.Its very urgent please can any one help me out in this.
    Regards,
    Lakshmi

    Hi Nutan,
    if you want to solve it with webdynpro it depends on your skills in java and abap. There are books available to start with webdynpro and there are examples for building tree structures with Webdynpro.
    [Java Webdynpro|http://www.sappress.com/product.cfm?account=&product=H983]
    [ABAP Webdynpro|http://www.sappress.com/product.cfm?account=&product=H1916]
    If you want to do it in VC you have to write e.g. an ABAP rfc function module, which returns you the tree with the information about childnode, parentnode and so on, so that you can display it in the table. But if the users click on sort then the tree is "destroyed". You can also display only a few levels of your tree and when you select a certain node a drill down is done by calling a rfc which returns the child nodes of the corresponding node.
    But I think the solution with VC is not the best. Use webdynpro for this requirements.
    Best Regards,
    Marcel

  • How to get Tree structure in JSP page?

    Hi,
    I would like get data from the database and display the data in tree structure with the check boxes at each nodes on a jsp page with out using any third party tools. how can i do that? Do i require any new tags to fulfill this requirement?
    can any one help me out by sending any example code?
    thanks in advance.
    Regards,
    Reddy

    Once you have the data in a list or something, can't you just use <c:forEach> and then output standard nested <ul> and <li> tags to give the tree structure.
    <html>
         <style>
              li
                   list-style-type:none;
         </style>
         <body>
              <form>
                   <ul>
                        <li>
                             <input type="checkbox">Check 1</input>
                             <ul>
                                  <li>
                                       <input type="checkbox">Check 1A</input>
                                  </li>
                                  <li>
                                       <input type="checkbox">Check 1B</input>
                                  </li>
                             </ul>
                        </li>
                        <li>
                             <input type="checkbox">Check 2</input>
                             <ul>
                                  <li>
                                       <input type="checkbox">Check 2A</input>
                                  </li>
                             </ul>
                        </li>
                        <li>
                             <input type="checkbox">Check 3</input>
                        </li>
                   </ul>
              </form>
         </body>
    </html>

Maybe you are looking for