Parent child relation tables

Hi experts,
Please check it my code . in this procedure first cursor only inserted into t1 temp table not inserted second cursor please check it and modified the my code.
i want inserted parent child relation table like bellow
parent child
a b
a c
a d
b l
b m
b n
c d like that only inserted
PROCEDURE TEST_PARENTS_CHILD( p_TABLE VARCHAR2)
IS
CURSOR c(P_TABLE varchar2)
IS
SELECT p.table_name PARENT, c.table_name CHILD
FROM user_constraints p, user_constraints c
WHERE (p.constraint_type = 'P' OR p.constraint_type = 'U')
AND c.constraint_type = 'R'
AND p.constraint_name = c.r_constraint_name
AND p.table_name = P_TABLE;
CURSOR C1(p_child varchar2) IS SELECT p.table_name PARENT_TABLE, c.table_name CHILD_TABLE
FROM user_constraints p, user_constraints c
WHERE (p.constraint_type = 'P' OR p.constraint_type = 'U')
AND c.constraint_type = 'R'
AND p.constraint_name = c.r_constraint_name
AND p.table_name = P_CHILD;
type array
IS
TABLE OF T1%ROWTYPE INDEX BY PLS_INTEGER;
t_data ARRAY;
BEGIN
FOR I IN C(P_TABLE)
LOOP
FETCH C bulk collect INTO T_DATA limit 1000;
--- EXIT WHEN C%NOTFOUND;
FORALL I IN 1..T_DATA.last
INSERT INTO T1 VALUES T_DATA(I);
FOR J IN C1(i.CHILD)
LOOP
FETCH C1 BULK COLLECT INTO T_DATA LIMIT 1000;
--EXIT
--WHEN C1%NOTFOUND;
FORALL j IN 1..T_DATA.last
INSERT INTO T1 VALUES T_DATA(j);
end loop;
END LOOP;
END TEST_PARENTS_CHILD;
Regards,
Venkat

You've been asked before on your previous questions (all of which still appear to be unanswered) to read the FAQ: {message:id=9360002} and post correct details of your question, and use {noformat}{noformat} tags to preserve your code/data formatting on the forum.
But still you post a question lacking all the information and formatting.  If you can't be bothered to help us understand your issue (and read your code), why do you expect others will be bothered to try and help you?                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

Similar Messages

  • Why in case of parent child relation iterator fetching one duplicate record

    Hi,
    JDev Ver : 11.1.1.2.0
    Technology : JPA/TopLik Service Facade Data Control (Without using BC4J)
    I have created JPA/TopLink service facade from DB Tables and on facades I have crated DataControl which I have draged and droped on my screen to create input text, table etc.
    In my application, I have many tables having one to many relationships. (Primarykey foreign key).
    When I add more then one child columns (foreign key columns) for any one parent column (primary key column), in db its getting inserted properly but in iterator after refreshing also it showing one duplicate entry instead of actual entry.
    e.g.
    For one Account Id 1234 (primary key) , I am adding 3 account holders name (abc, xyz, pqr) in this case in db its inserting proper 3 entries but in iterator its showing
    1234 abc
    1234 xyz
    1234 abc
    so instead of pqr its again showing abc.
    To select account holders name I have used selectManyShuttle components.
    I have also tried tried dciter.refresh(DCIteratorBinding.RANGESIZE_UNLIMITED); to refresh iterator.
    This is generic problem on most of the screen in my application where parent child relation comes.
    regards,
    devang

    Hi,
    Thanks for your reply. I just emailed the screen shot to your email . Please verify and let me know your comment.
    Regards,
    Kiran Konjeti

  • How to delete parent child relation in Toplink

    Hi All,
    I have 3 tables A,B,C.
    In Table A ,I am saving record.
    Table B & C has parent child relation.
    B-->Parent
    C-->Child
    So I want to save records in Table A.
    And delete from child(C) 1st then from parent(B).
    I m writing my code as,
    em.getTransaction().begin();
    em.persist(Table A);//save in Table A
    em.remove(em.merge(Table B));//Remove from Parent
    But how to delete records from child table then from parent table.
    Thanks
    Sandip

    If you have a @OneToOne relationship between two entities, the join column information is used to order the SQL when you remove two entities. For example, if I have:
    @Entity
    public class Employee implements Serializable {
         @OneToOne
         @JoinColumn(name="ADDR_ID")
         private Address address;
    ...Then the following code runs regardless of the order of the remove calls.
              em.getTransaction().begin();
              Employee parent = new Employee();
              Address child = new Address();
              parent.setAddress(child);
              em.persist(parent);
              em.persist(child);
              em.getTransaction().commit();
              em.getTransaction().begin();
              parent = em.merge(parent);
              child = em.merge(child);
              // order of next two statements unimportant
              em.remove(parent);
              em.remove(child);
              em.getTransaction().commit();If I don't remove the parent and just the child I get the same error you do because of the FK from Employee to Address.
    --Shaun                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Parent Child relation in one transaction throws error... (

    In nutshell, I have a parent->child relation ship in DB and due to the UI requirement, I created view link as Child->parent, it is giving a hack a lot of problems.... (it sounds silly but looks like I am loosing my mind over this)
    Let me explain my situation,
    - I have a table A with col-a and col-b. I have another table B with col-a (primary key) and col-c. (This way table A is a parent table)
    - ON UI side i created relationship like table B is parent and Table A is child using col-a
    - I need to create parent-child (one record for each) record programatically.........
    I tried following thing:
    - from backing bean, as soon as i create Table-B row first, i get error saying too many objects with same key (which is understandable because of table design..... and associaion must be throwing that error)
    - from EOImpl file, it doesn't even find the child record being created... so during commit I can't send the foreign key value from Table-a to Table-b
    Any suggestion is greatly appreciated?
    Thank you,
    -Raj

    that depends on how you implement the multiple selection of orders.. you have to pass the selectedValues to the backend or store the values in a map or list and pass it..

  • Parent child relation in OBIEE -RPD Issue

    Hi,
    I created a star schema by taking two tables . Now i want to establish parent-child relation ship .
    Now by clicking create logical dimension ----->Dimension with parent-child hierarchy ,the member key is not found.Pls correct me where i went wrong .
    Thanks-Bhaskar

    I know you said you have primary key defined already but just to make sure, can you follow these steps:
    1) Double click on dimension table
    2) go to tab 'Keys'. check if your primary key is defined there.
    3) If not, in 'Key Name', type in the key name
    4) select the primary key(column) in 'Columns'.
    5) Click OK.
    and then try to create hierarchy by following these steps:
    1) Right Click on the dimension table
    2) Create Logical Dimension -> Dimension with Parent-Child Hierarchy...
    3) Click OK (if you are OK with default values)

  • Changing into parent-child relation

    Hi,
    I have a table which has the following fields and the table gives the identifier for parent-child relation:
    ID
    PARENT ID
    structure
    parentkey_field
    foreignkey_field
    Fields[]
    data[]
    1.ID is the numbering like 1,2,3...
    2.PARENT ID will give the relation like which structure is the child for which   structure.
      Example: I have two structures HEADER and ITEM.Then the IDs will be 1 and 2.The parent id for ITEM will be 1(ID OF HEADER).
    3.Structure is the header/item structure names.
    4.parentkey_field and foreignkey_field are defining the header-child relation identifier fields.
    5.fields[] is the table with all the fields of header and item.
    6.DATA[] is the table having the data of header/item fields.
    Now my requirement is to flatten this table into one more table(with field structure_name,fieldname,value) with parent-child relation.
    Can anyone suggest something.

    It would be better if you posted the code you tried first and then having others help you with what's wrong.  Flattening a hierarchy is not that difficult; why don't you give it a shot first?

  • Representating Hierarchical (Parent-Child) relation graphically using Swing

    Hi,
    I have to represent a hierarchical data which is having Parent-Child relation using Swing. I am not able to upload the image overhere, so I am represnting the data in such a way so that one can understand this problem. If anyone knows how to upload image on Sun forum, please let me know it will be great help for me.
    Parent Root - A
    Child of A - B, C, D
    Child of C - E, F, G
    Child of F - H
    Child of D - J, K
    The data needs to be represented in two formats-
    1. Tabular Format
    I am able to represent data in this format using combination of JTree and JTable. The data is getting represented in tabular format and I am able to expand and collapse the parent nodes to see the childs. The tabular data will look like below structure,
    A
    I_B
    I
    I_C
    I I_E
    I I
    I I_F
    | I |_H
    | I
    I I_G
    I
    I_D
    I
    I_J
    I
    I_K
    2. Graphical Format
    This is the other way in which I need to represent the data. The above shown tabular data needs to represented in graphical form. The end result should look like,
    I A I
    ____________________I__________________________
    ___I___ __I__ __I__
    I  B  I I  C   I I  D   I
    ____________________I____________ ______I________
    ___I___ __I__ __I__ __I__ ___I__
    I  E  I I  F   I I  G   I I  J   I I   K    I
    __I___
    I   H   I
    Each box representing alphabates will be a component (like JPanel) which will have details about the item to be displayed. The parent and child should be connected with each other using line. This representation should be created at runtime using the hierarchical data. Also the parent and child relations should be expandable/collapsible as they are in JTree.
    I am not able to find any component or any solution in Swing which can provide me this graphical representation. It will be great help if anyone can help me out in this.
    Thanks in advance.

    Sorry for inconvinience for the data representaion in graphical form. I don't know how this get jumblled. Please try to figure out the tabular/graphical representation using pen and paper as forum is not providing any help to upload an image.
    Sorry again for inconvinience.
    Thanks
    Manoj Rai

  • Creating View for a table with parent child relation in table

    I need help creating a view. It is on a base table which is a metadata table.It is usinf parent child relationship. There are four types of objects, Job, Workflow, Dataflow and ABAP dataflow. Job would be the root parent everytime. I have saved all the jobs
    of the project in another table TABLE_JOB with column name JOB_NAME. Query should iteratively start from the job and search all the child nodes and then display all child with the job name. Attached are the images of base table data and expected view data
    and also the excel sheet with data.Picture 1 is the sample data in base table. Picture 2 is data in the view.
    Base Table
    PARENT_OBJ
    PAREBT_OBJ_TYPE
    DESCEN_OBJ
    DESCEN_OBJ_TYPE
    JOB_A
    JOB
    WF_1
    WORKFLOW
    JOB_A
    JOB
    DF_1
    DATAFLOW
    WF_1
    WORKFLOW
    DF_2
    DATAFLOW
    DF_1
    DATAFLOW
    ADF_1
    ADF
    JOB_B
    JOB
    WF_2
    WORKFLOW
    JOB_B
    JOB
    WF_3
    WORKFLOW
    WF_2
    WORKFLOW
    DF_3
    DATAFLOW
    WF_3
    WORKFLOW
    DF_4
    DATAFLOW
    DF_4
    DATAFLOW
    ADF_2
    ADF
    View
    Job_Name
    Flow_Name
    Flow_Type
    Job_A
    WF_1
    WORKFLOW
    Job_A
    DF_1
    DATAFLOW
    Job_A
    DF_2
    DATAFLOW
    Job_A
    ADF_1
    ADF
    Job_B
    WF_2
    WORKFLOW
    Job_B
    WF_3
    WORKFLOW
    Job_B
    DF_3
    DATAFLOW
    Job_B
    DF_4
    DATAFLOW
    Job_B
    ADF_2
    ADF
    I implemented the same in oracle using CONNECT_BY_ROOT and START WITH.
    Regards,
    Megha

    I think what you need is recursive CTE
    Consider your table below
    create table basetable
    (PARENT_OBJ varchar(10),
    PAREBT_OBJ_TYPE varchar(10),
    DESCEN_OBJ varchar(10),DESCEN_OBJ_TYPE varchar(10))
    INSERT basetable(PARENT_OBJ,PAREBT_OBJ_TYPE,DESCEN_OBJ,DESCEN_OBJ_TYPE)
    VALUES('JOB_A','JOB','WF_1','WORKFLOW'),
    ('JOB_A','JOB','DF_1','DATAFLOW'),
    ('WF_1','WORKFLOW','DF_2','DATAFLOW'),
    ('DF_1','DATAFLOW','ADF_1','ADF'),
    ('JOB_B','JOB','WF_2','WORKFLOW'),
    ('JOB_B','JOB','WF_3','WORKFLOW'),
    ('WF_2','WORKFLOW','DF_3','DATAFLOW'),
    ('WF_3','WORKFLOW','DF_4','DATAFLOW'),
    ('DF_4','DATAFLOW','ADF_2','ADF')
    ie first create a UDF like below to get hierarchy recursively
    CREATE FUNCTION GetHierarchy
    @Object varchar(10)
    RETURNS @RESULTS table
    PARENT_OBJ varchar(10),
    DESCEN_OBJ varchar(10),
    DESCEN_OBJ_TYPE varchar(10)
    AS
    BEGIN
    ;With CTE
    AS
    SELECT PARENT_OBJ,DESCEN_OBJ,DESCEN_OBJ_TYPE
    FROM basetable
    WHERE PARENT_OBJ = @Object
    UNION ALL
    SELECT b.PARENT_OBJ,b.DESCEN_OBJ,b.DESCEN_OBJ_TYPE
    FROM CTE c
    JOIN basetable b
    ON b.PARENT_OBJ = c.DESCEN_OBJ
    INSERT @RESULTS
    SELECT @Object,DESCEN_OBJ,DESCEN_OBJ_TYPE
    FROM CTE
    OPTION (MAXRECURSION 0)
    RETURN
    END
    Then you can invoke it as below
    SELECT * FROM dbo.GetHierarchy('JOB_A')
    Now you need to use this for every parent obj (start obj) in view 
    for that create view as below
    CREATE VIEW vw_Table
    AS
    SELECT f.*
    FROM (SELECT DISTINCT PARENT_OBJ FROM basetable r
    WHERE NOT EXISTS (SELECT 1
    FROM basetable WHERE DESCEN_OBJ = r.PARENT_OBJ)
    )b
    CROSS APPLY dbo.GetHierarchy(b.PARENT_OBJ) f
    GO
    This will make sure it will give full hieraracy for each start object
    Now just call view as below and see the output
    SELECT * FROM vw_table
    Output
    PARENT_OBJ DESCEN_OBJ DESCEN_OBJ_TYPE
    JOB_A WF_1 WORKFLOW
    JOB_A DF_1 DATAFLOW
    JOB_A ADF_1 ADF
    JOB_A DF_2 DATAFLOW
    JOB_B WF_2 WORKFLOW
    JOB_B WF_3 WORKFLOW
    JOB_B DF_4 DATAFLOW
    JOB_B ADF_2 ADF
    JOB_B DF_3 DATAFLOW
    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

  • Parent Child relation SQL -

    Hi all,
    I am trying to write an sql - and the requirement is as below -
    Table data contains columns Parent || Child || Summary_Flag
    If Child is Parent again to some other Child then Summary Flag is "Y"
    e.g. parent || Child || Summary_flag
    P1 C1 N
    P2 P3 Y
    P3 C2 N
    This relation exists to four level - .i.e. level to which child can be parent again.
    I am trying to write SQL which will give me data in columns - i.e. Parent1||Parent2||Parent3||Parent4||Child.
    Pleas help in any possible way.
    thanks
    Bhushan

    hI,
    What is your desired output ?
    Like this.
    P1|C1
    P2|P3|C2
    SELECT   REGEXP_REPLACE (MAX (res)KEEP (DENSE_RANK LAST ORDER BY lvl),
                            ) res
        FROM (SELECT     PARENT,
                         SYS_CONNECT_BY_PATH (   CASE
                                                    WHEN LEVEL = 1
                                                       THEN PARENT
                                                 END
                                              || '|'
                                              || CHILD,
                                             ) res,
                         LEVEL lvl
                    FROM test_data
                   WHERE  summary_flag = 'N'
              CONNECT BY  PRIOR CHILD = PARENT)
    GROUP BY PARENT
    SQL> WITH test_data AS
      2       (SELECT 'P1' PARENT, 'C1' CHILD, 'N' summary_flag
      3          FROM DUAL
      4        UNION ALL
      5        SELECT 'P2' PARENT, 'P3' CHILD, 'Y' summary_flag
      6          FROM DUAL
      7        UNION ALL
      8        SELECT 'P3' PARENT, 'P4' CHILD, 'Y' summary_flag
      9          FROM DUAL
    10        UNION ALL
    11        SELECT 'P4' PARENT, 'C2' CHILD, 'N' summary_flag
    12          FROM DUAL)
    13  SELECT   REGEXP_REPLACE (MAX (res)KEEP (DENSE_RANK LAST ORDER BY lvl),
    14                           '/'
    15                          ) res
    16      FROM (SELECT     PARENT,
    17                       SYS_CONNECT_BY_PATH (   CASE
    18                                                  WHEN LEVEL = 1
    19                                                     THEN PARENT
    20                                               END
    21                                            || '|'
    22                                            || CHILD,
    23                                            '/'
    24                                           ) res,
    25                       LEVEL lvl
    26                  FROM test_data
    27                 WHERE  summary_flag = 'N'
    28            CONNECT BY  PRIOR CHILD = PARENT)
    29  GROUP BY PARENT;
    RES
    P1|C1
    P2|P3|P4|C2
    SQL> Regards salim.

  • Dynamic hierarchy in parent child hierarchy table??

    Do you have any experience to handle the requirement of dynamic hierarchy in universe/webi?
    We have some data in parent child hierarchy as below u201CCustomeru201D table.
    Customer
    Parent          Child
    Z                  A
    Z                  B
    A                  AA
    B                  BB
    AA               AAA
    For example, Company Z is the parent company of Company A.
    Another table, Amount is the amount value of different Customers.
    Amount
    ID               Amt
    AA               10
    AAA            1
    BB                2
    Is there any functionality in Universe designer to build related Classes and objects, So that the web intelligence documents represent the following report with the drilling results?
    When we want to see the ID and Amt, the expected result should be:
    Z                13
    when we drill down Z
    the result should be:
    A                11
    B                2
    when we drill down A:
    the result should be:
    AA              11
    notes **
    the level of hierarchy is dynamic
    Any suggestion is appreciated.  Thanks.

    Hi,
    The only way to do it is to create recursive derived table that flatten you parent child hierarchy with a given maximum depth.
    Here is a sample I built a long time ago to flatten a parent-child hierarchy on Employees table in Foodmart database (SQL Server).
    Didier
    SELECT DISTINCT
         Z.employee_id,
         A.supervisor_id_1,
         A.employee_id_1,
         A.full_name_1,
         A.supervisor_id_2,
         A.employee_id_2,
         A.full_name_2,
         A.supervisor_id_3,
         A.employee_id_3,
         A.full_name_3,
         A.supervisor_id_4,
         A.employee_id_4,
         A.full_name_4,
         A.supervisor_id_5,
         A.employee_id_5,
         A.full_name_5,
         A.supervisor_id_6,
         A.employee_id_6,
         A.full_name_6,
         Z.supervisor_id AS supervisor_id_7,
         Z.employee_id AS employee_id_7,
         Z.full_name AS full_name_7
    FROM employee Z,
         SELECT DISTINCT
              A.supervisor_id_1,
              A.employee_id_1,
              A.full_name_1,
              A.supervisor_id_2,
              A.employee_id_2,
              A.full_name_2,
              A.supervisor_id_3,
              A.employee_id_3,
              A.full_name_3,
              A.supervisor_id_4,
              A.employee_id_4,
              A.full_name_4,
              A.supervisor_id_5,
              A.employee_id_5,
              A.full_name_5,
              Z.supervisor_id AS supervisor_id_6,
              Z.employee_id AS employee_id_6,
              Z.full_name AS full_name_6
         FROM employee Z,
              SELECT DISTINCT
                   A.supervisor_id_1,
                   A.employee_id_1,
                   A.full_name_1,
                   A.supervisor_id_2,
                   A.employee_id_2,
                   A.full_name_2,
                   A.supervisor_id_3,
                   A.employee_id_3,
                   A.full_name_3,
                   A.supervisor_id_4,
                   A.employee_id_4,
                   A.full_name_4,
                   Z.supervisor_id AS supervisor_id_5,
                   Z.employee_id AS employee_id_5,
                   Z.full_name AS full_name_5
              FROM employee Z,
                   SELECT DISTINCT
                        A.supervisor_id_1,
                        A.employee_id_1,
                        A.full_name_1,
                        A.supervisor_id_2,
                        A.employee_id_2,
                        A.full_name_2,
                        A.supervisor_id_3,
                        A.employee_id_3,
                        A.full_name_3,
                        Z.supervisor_id AS supervisor_id_4,
                        Z.employee_id AS employee_id_4,
                        Z.full_name AS full_name_4
                   FROM employee Z,
                        SELECT DISTINCT
                             A.supervisor_id_1,
                             A.employee_id_1,
                             A.full_name_1,
                             A.supervisor_id_2,
                             A.employee_id_2,
                             A.full_name_2,
                             Z.supervisor_id AS supervisor_id_3,
                             Z.employee_id AS employee_id_3,
                             Z.full_name AS full_name_3
                        FROM employee Z,
                             SELECT DISTINCT
                                  A.supervisor_id_1,
                                  A.employee_id_1,
                                  A.full_name_1,
                                  Z.supervisor_id AS supervisor_id_2,
                                  Z.employee_id AS employee_id_2,
                                  Z.full_name AS full_name_2
                             FROM employee Z,
                                  SELECT DISTINCT
                                       supervisor_id AS supervisor_id_1,
                                       employee_id AS employee_id_1,
                                       full_name AS full_name_1
                                   FROM employee
                                   WHERE supervisor_id = 0 OR supervisor_id IS NULL
                             ) A
                             WHERE A.employee_id_1 = Z.supervisor_id
                        ) A
                        WHERE A.employee_id_2 = Z.supervisor_id
                   ) A
                   WHERE A.employee_id_3 = Z.supervisor_id
              ) A
              WHERE A.employee_id_4 = Z.supervisor_id
         ) A
         WHERE A.employee_id_5 = Z.supervisor_id
    ) A
    WHERE A.employee_id_6 = Z.supervisor_id
    UNION
    SELECT DISTINCT
         A.employee_id_6 AS employee_id,
         A.supervisor_id_1,
         A.employee_id_1,
         A.full_name_1,
         A.supervisor_id_2,
         A.employee_id_2,
         A.full_name_2,
         A.supervisor_id_3,
         A.employee_id_3,
         A.full_name_3,
         A.supervisor_id_4,
         A.employee_id_4,
         A.full_name_4,
         A.supervisor_id_5,
         A.employee_id_5,
         A.full_name_5,
         A.supervisor_id_6,
         A.employee_id_6,
         A.full_name_6,
         NULL AS supervisor_id_7,
         NULL AS employee_id_7,
         NULL AS full_name_7
    FROM employee Z,
         SELECT DISTINCT
              A.supervisor_id_1,
              A.employee_id_1,
              A.full_name_1,
              A.supervisor_id_2,
              A.employee_id_2,
              A.full_name_2,
              A.supervisor_id_3,
              A.employee_id_3,
              A.full_name_3,
              A.supervisor_id_4,
              A.employee_id_4,
              A.full_name_4,
              A.supervisor_id_5,
              A.employee_id_5,
              A.full_name_5,
              Z.supervisor_id AS supervisor_id_6,
              Z.employee_id AS employee_id_6,
              Z.full_name AS full_name_6
         FROM employee Z,
              SELECT DISTINCT
                   A.supervisor_id_1,
                   A.employee_id_1,
                   A.full_name_1,
                   A.supervisor_id_2,
                   A.employee_id_2,
                   A.full_name_2,
                   A.supervisor_id_3,
                   A.employee_id_3,
                   A.full_name_3,
                   A.supervisor_id_4,
                   A.employee_id_4,
                   A.full_name_4,
                   Z.supervisor_id AS supervisor_id_5,
                   Z.employee_id AS employee_id_5,
                   Z.full_name AS full_name_5
              FROM employee Z,
                   SELECT DISTINCT
                        A.supervisor_id_1,
                        A.employee_id_1,
                        A.full_name_1,
                        A.supervisor_id_2,
                        A.employee_id_2,
                        A.full_name_2,
                        A.supervisor_id_3,
                        A.employee_id_3,
                        A.full_name_3,
                        Z.supervisor_id AS supervisor_id_4,
                        Z.employee_id AS employee_id_4,
                        Z.full_name AS full_name_4
                   FROM employee Z,
                        SELECT DISTINCT
                             A.supervisor_id_1,
                             A.employee_id_1,
                             A.full_name_1,
                             A.supervisor_id_2,
                             A.employee_id_2,
                             A.full_name_2,
                             Z.supervisor_id AS supervisor_id_3,
                             Z.employee_id AS employee_id_3,
                             Z.full_name AS full_name_3
                        FROM employee Z,
                             SELECT DISTINCT
                                  A.supervisor_id_1,
                                  A.employee_id_1,
                                  A.full_name_1,
                                  Z.supervisor_id AS supervisor_id_2,
                                  Z.employee_id AS employee_id_2,
                                  Z.full_name AS full_name_2
                             FROM employee Z,
                                  SELECT DISTINCT
                                       supervisor_id AS supervisor_id_1,
                                       employee_id AS employee_id_1,
                                       full_name AS full_name_1
                                   FROM employee
                                   WHERE supervisor_id = 0 OR supervisor_id IS NULL
                             ) A
                             WHERE A.employee_id_1 = Z.supervisor_id
                        ) A
                        WHERE A.employee_id_2 = Z.supervisor_id
                   ) A
                   WHERE A.employee_id_3 = Z.supervisor_id
              ) A
              WHERE A.employee_id_4 = Z.supervisor_id
         ) A
         WHERE A.employee_id_5 = Z.supervisor_id
    ) A
    UNION
    SELECT DISTINCT
         A.employee_id_5 AS employee_id,
         A.supervisor_id_1,
         A.employee_id_1,
         A.full_name_1,
         A.supervisor_id_2,
         A.employee_id_2,
         A.full_name_2,
         A.supervisor_id_3,
         A.employee_id_3,
         A.full_name_3,
         A.supervisor_id_4,
         A.employee_id_4,
         A.full_name_4,
         A.supervisor_id_5,
         A.employee_id_5,
         A.full_name_5,
         NULL AS supervisor_id_6,
         NULL AS employee_id_6,
         NULL AS full_name_6,
         NULL AS supervisor_id_7,
         NULL AS employee_id_7,
         NULL AS full_name_7
    FROM employee Z,
         SELECT DISTINCT
              A.supervisor_id_1,
              A.employee_id_1,
              A.full_name_1,
              A.supervisor_id_2,
              A.employee_id_2,
              A.full_name_2,
              A.supervisor_id_3,
              A.employee_id_3,
              A.full_name_3,
              A.supervisor_id_4,
              A.employee_id_4,
              A.full_name_4,
              Z.supervisor_id AS supervisor_id_5,
              Z.employee_id AS employee_id_5,
              Z.full_name AS full_name_5
         FROM employee Z,
              SELECT DISTINCT
                   A.supervisor_id_1,
                   A.employee_id_1,
                   A.full_name_1,
                   A.supervisor_id_2,
                   A.employee_id_2,
                   A.full_name_2,
                   A.supervisor_id_3,
                   A.employee_id_3,
                   A.full_name_3,
                   Z.supervisor_id AS supervisor_id_4,
                   Z.employee_id AS employee_id_4,
                   Z.full_name AS full_name_4
              FROM employee Z,
                   SELECT DISTINCT
                        A.supervisor_id_1,
                        A.employee_id_1,
                        A.full_name_1,
                        A.supervisor_id_2,
                        A.employee_id_2,
                        A.full_name_2,
                        Z.supervisor_id AS supervisor_id_3,
                        Z.employee_id AS employee_id_3,
                        Z.full_name AS full_name_3
                   FROM employee Z,
                        SELECT DISTINCT
                             A.supervisor_id_1,
                             A.employee_id_1,
                             A.full_name_1,
                             Z.supervisor_id AS supervisor_id_2,
                             Z.employee_id AS employee_id_2,
                             Z.full_name AS full_name_2
                        FROM employee Z,
                             SELECT DISTINCT
                                  supervisor_id AS supervisor_id_1,
                                  employee_id AS employee_id_1,
                                  full_name AS full_name_1
                              FROM employee
                              WHERE supervisor_id = 0 OR supervisor_id IS NULL
                        ) A
                        WHERE A.employee_id_1 = Z.supervisor_id
                   ) A
                   WHERE A.employee_id_2 = Z.supervisor_id
              ) A
              WHERE A.employee_id_3 = Z.supervisor_id
         ) A
         WHERE A.employee_id_4 = Z.supervisor_id
    ) A
    UNION
    SELECT DISTINCT
         A.employee_id_4 AS employee_id,
         A.supervisor_id_1,
         A.employee_id_1,
         A.full_name_1,
         A.supervisor_id_2,
         A.employee_id_2,
         A.full_name_2,
         A.supervisor_id_3,
         A.employee_id_3,
         A.full_name_3,
         A.supervisor_id_4,
         A.employee_id_4,
         A.full_name_4,
         NULL AS supervisor_id_5,
         NULL AS employee_id_5,
         NULL AS full_name_5,
         NULL AS supervisor_id_6,
         NULL AS employee_id_6,
         NULL AS full_name_6,
         NULL AS supervisor_id_7,
         NULL AS employee_id_7,
         NULL AS full_name_7
    FROM employee Z,
         SELECT DISTINCT
              A.supervisor_id_1,
              A.employee_id_1,
              A.full_name_1,
              A.supervisor_id_2,
              A.employee_id_2,
              A.full_name_2,
              A.supervisor_id_3,
              A.employee_id_3,
              A.full_name_3,
              Z.supervisor_id AS supervisor_id_4,
              Z.employee_id AS employee_id_4,
              Z.full_name AS full_name_4
         FROM employee Z,
              SELECT DISTINCT
                   A.supervisor_id_1,
                   A.employee_id_1,
                   A.full_name_1,
                   A.supervisor_id_2,
                   A.employee_id_2,
                   A.full_name_2,
                   Z.supervisor_id AS supervisor_id_3,
                   Z.employee_id AS employee_id_3,
                   Z.full_name AS full_name_3
              FROM employee Z,
                   SELECT DISTINCT
                        A.supervisor_id_1,
                        A.employee_id_1,
                        A.full_name_1,
                        Z.supervisor_id AS supervisor_id_2,
                        Z.employee_id AS employee_id_2,
                        Z.full_name AS full_name_2
                   FROM employee Z,
                        SELECT DISTINCT
                             supervisor_id AS supervisor_id_1,
                             employee_id AS employee_id_1,
                             full_name AS full_name_1
                         FROM employee
                         WHERE supervisor_id = 0 OR supervisor_id IS NULL
                   ) A
                   WHERE A.employee_id_1 = Z.supervisor_id
              ) A
              WHERE A.employee_id_2 = Z.supervisor_id
         ) A
         WHERE A.employee_id_3 = Z.supervisor_id
    ) A
    UNION
    SELECT DISTINCT
         A.employee_id_3 AS employee_id,
         A.supervisor_id_1,
         A.employee_id_1,
         A.full_name_1,
         A.supervisor_id_2,
         A.employee_id_2,
         A.full_name_2,
         A.supervisor_id_3,
         A.employee_id_3,
         A.full_name_3,
         NULL AS supervisor_id_4,
         NULL AS employee_id_4,
         NULL AS full_name_4,
         NULL AS supervisor_id_5,
         NULL AS employee_id_5,
         NULL AS full_name_5,
         NULL AS supervisor_id_6,
         NULL AS employee_id_6,
         NULL AS full_name_6,
         NULL AS supervisor_id_7,
         NULL AS employee_id_7,
         NULL AS full_name_7
    FROM employee Z,
         SELECT DISTINCT
              A.supervisor_id_1,
              A.employee_id_1,
              A.full_name_1,
              A.supervisor_id_2,
              A.employee_id_2,
              A.full_name_2,
              Z.supervisor_id AS supervisor_id_3,
              Z.employee_id AS employee_id_3,
              Z.full_name AS full_name_3
         FROM employee Z,
              SELECT DISTINCT
                   A.supervisor_id_1,
                   A.employee_id_1,
                   A.full_name_1,
                   Z.supervisor_id AS supervisor_id_2,
                   Z.employee_id AS employee_id_2,
                   Z.full_name AS full_name_2
              FROM employee Z,
                   SELECT DISTINCT
                        supervisor_id AS supervisor_id_1,
                        employee_id AS employee_id_1,
                        full_name AS full_name_1
                    FROM employee
                    WHERE supervisor_id = 0 OR supervisor_id IS NULL
              ) A
              WHERE A.employee_id_1 = Z.supervisor_id
         ) A
         WHERE A.employee_id_2 = Z.supervisor_id
    ) A
    UNION
    SELECT DISTINCT
         A.employee_id_2 AS employee_id,
         A.supervisor_id_1,
         A.employee_id_1,
         A.full_name_1,
         A.supervisor_id_2,
         A.employee_id_2,
         A.full_name_2,
         NULL AS supervisor_id_3,
         NULL AS employee_id_3,
         NULL AS full_name_3,
         NULL AS supervisor_id_4,
         NULL AS employee_id_4,
         NULL AS full_name_4,
         NULL AS supervisor_id_5,
         NULL AS employee_id_5,
         NULL AS full_name_5,
         NULL AS supervisor_id_6,
         NULL AS employee_id_6,
         NULL AS full_name_6,
         NULL AS supervisor_id_7,
         NULL AS employee_id_7,
         NULL AS full_name_7
    FROM employee Z,
         SELECT DISTINCT
              A.supervisor_id_1,
              A.employee_id_1,
              A.full_name_1,
              Z.supervisor_id AS supervisor_id_2,
              Z.employee_id AS employee_id_2,
              Z.full_name AS full_name_2
         FROM employee Z,
              SELECT DISTINCT
                   supervisor_id AS supervisor_id_1,
                   employee_id AS employee_id_1,
                   full_name AS full_name_1
               FROM employee
               WHERE supervisor_id = 0 OR supervisor_id IS NULL
         ) A
         WHERE A.employee_id_1 = Z.supervisor_id
    ) A
    UNION
    SELECT DISTINCT
         A.employee_id_1 AS employee_id,
         A.supervisor_id_1,
         A.employee_id_1,
         A.full_name_1,
         NULL AS supervisor_id_2,
         NULL AS employee_id_2,
         NULL AS full_name_2,
         NULL AS supervisor_id_3,
         NULL AS employee_id_3,
         NULL AS full_name_3,
         NULL AS supervisor_id_4,
         NULL AS employee_id_4,
         NULL AS full_name_4,
         NULL AS supervisor_id_5,
         NULL AS employee_id_5,
         NULL AS full_name_5,
         NULL AS supervisor_id_6,
         NULL AS employee_id_6,
         NULL AS full_name_6,
         NULL AS supervisor_id_7,
         NULL AS employee_id_7,
         NULL AS full_name_7
    FROM employee Z,
         SELECT DISTINCT
              supervisor_id AS supervisor_id_1,
              employee_id AS employee_id_1,
              full_name AS full_name_1
          FROM employee
          WHERE supervisor_id = 0 OR supervisor_id IS NULL
    ) A

  • Hierarchy Parent Child Relation Storage

    Hello All,
                I need to display hier. info in parent-child format. Any ideas on how to store parent child relationship in an ODS....I can view this format in the infoobject display screen for hierarchy...but cannot get this format to display..
    EX: Parent - child1,2,3,4
          child1- child 1-1,1-2,...
          child2 - child 2-1,2-2...
    thanks

    Spanyal,
    You will have to write a program to store this information in an ODS object. You will have to use /BIC/h<IO> Table to read the data and update a custom table. You will have to do some basic checks like business content or not, plan version, time dependency etc in the entry screen and then the program can read the hierarchy table in the format you want.
    I am not aware of any simpler way to populate hierarchy data into an ods object in a meaningful fashion.
    -Saket

  • Parent child relation using query

    Hi,
    If i pass one parameter as a parent.It will
    retrieve all the child and subchild...
    but it will be retrieved by one single query.
    Is it possible?If possible pls give me an idea.
    I got the inner most child using stored procedure and recursive fn.
    But I couldnt get the child and subchild using
    single query....
    pls give an idea
    below i gave table for example
    Sno     Parent     Child
    1     MD     GM
    2     GM     Material manager
    3     GM     Production manager
    4     Production manager     Material staff
    5     Material staff     production staff
    6     production staff     Material student
    7     Material student     production student
    if i pass GM as a parent. it will retrieve
    material manager and production manager...but it will be worked in single query
    Thanks

    Hi,
    SELECT * FROM t11
    START WITH parent='GM'
    CONNECT BY PRIOR child=parent
    Out put :-
    2 GM Material manager
    3 GM Production manager
    4 Production manager Material staff
    5 Material staff production staff
    6 production staff Material student
    7 Material student production student
    Pavan Kumar N

  • Issue to check in parent-child closure table attributes to OBIEE repository

    I use OBIEE 11.1.1.5 Administration Tool to open repository in online mode and set up parent-child hierarchy. There are no issues but after I check in changes to server, close repository and open it back from server, closure table attributes are missing.
    On the other hand when I save repository file locally, close it and then open offline, all mentioned attributes are there. Also all other modifications (except hierarchy) are properly checked in to remote repository.
    When I compare UDML from remote and local copy of repository here is part missing in remote:
    CLOSURE TABLE ATTRIBUTES( "xxx".."yy"."ORG_STRUCTURE_CLOSURE"."MEMBER_KEY",
              "xxx".."yy"."ORG_STRUCTURE_CLOSURE"."ANCESTOR_KEY",
              "xxx".."yy"."ORG_STRUCTURE_CLOSURE"."DISTANCE",
              "xxx".."yy"."ORG_STRUCTURE_CLOSURE"."IS_LEAF")
    When trying to build web report I get "[nQSError: 38107] Not all four columns are defined for closure table" (which is actually not surprising).
    Unfortunately I need to do this change in online mode without restarting obiee services.
    Any ideas how to force admin tool to check in all changes to remote repository?

    Finally I applied workaround:
    - modified hierarchy in offline mode
    - deployed repository
    Now when importing repo in online mode closure table parameters are in place.

  • Incorrect query forms in parent child relation

    Hello
    I am using jdev of RUP3 (Release 4) which is 11.1.1.6.2 and have following scenario
    I have a ParentVO (ProfileVO) and a child VO(CreditReceiversVO) (child VO is basically extended from another VO not in this application and included as a jar library).
    There a VL between ParentVO and ChildVO 1:* with two attributes ord_id and rule_id
    On UI these two VO instances are dropped as parent child and I get exception on running page in logs saying RuleAssignementEO.ORG_ID invalid identifier.
    Looking into the query formed by BC4J I see it as below which is clearly wrong as the alias RuleAssignmentEO is not visible for the outermost where clause. Please advise
    "SELECT count(1) FROM (SELECT * FROM (SELECT /*+ FIRST_ROWS(10) */
    RuleAssignmentsEO.RULE_ASSIGNMENT_ID,
    RuleAssignmentsEO.OBJECT_VERSION_NUMBER,
    RuleAssignmentsEO.RULE_ID,
    RuleAssignmentsEO.ASSIGNED_OBJECT_ID,
    RuleAssignmentsEO.ASSIGNED_OBJECT_TYPE,
    RuleAssignmentsEO.ORG_ID,
    RuleAssignmentsEO.ROLE_ID,
    RuleAssignmentsEO.START_DATE,
    RuleAssignmentsEO.END_DATE,
    RuleAssignmentsEO.SPLIT_PCT,
    RuleAssignmentsEO.REVENUE_TYPE,
    RuleAssignmentsEO.ROLLUP_FLAG,
    RuleAssignmentsEO.CREATED_BY,
    RuleAssignmentsEO.CREATION_DATE,
    RuleAssignmentsEO.LAST_UPDATED_BY,
    RuleAssignmentsEO.LAST_UPDATE_DATE,
    RuleAssignmentsEO.LAST_UPDATE_LOGIN,
    RuleAssignmentsEO.ATTRIBUTE_CATEGORY,
    RuleAssignmentsEO.ATTRIBUTE1,
    RuleAssignmentsEO.ATTRIBUTE2,
    RuleAssignmentsEO.ATTRIBUTE3,
    RuleAssignmentsEO.ATTRIBUTE4,
    RuleAssignmentsEO.ATTRIBUTE5,
    RuleAssignmentsEO.ATTRIBUTE6,
    RuleAssignmentsEO.ATTRIBUTE7,
    RuleAssignmentsEO.ATTRIBUTE8,
    RuleAssignmentsEO.ATTRIBUTE9,
    RuleAssignmentsEO.ATTRIBUTE10,
    RuleAssignmentsEO.ATTRIBUTE11,
    RuleAssignmentsEO.ATTRIBUTE12,
    RuleAssignmentsEO.ATTRIBUTE13,
    RuleAssignmentsEO.ATTRIBUTE14,
    RuleAssignmentsEO.ATTRIBUTE15,
    RuleAssignmentsEO.GROUP_MEMBER_CREDIT_FLAG,
    RuleAssignmentsEO.SUMMARY_FLAG,
    ParticipantEO.PARTICIPANT_NAME,
    ParticipantEO.PARTICIPANT_ID
    FROM CN_RS_RULE_ASSIGNMENTS_ALL RuleAssignmentsEO, CN_SRP_PARTICIPANT_HDR_RO_V ParticipantEO
    WHERE RuleAssignmentsEO.ASSIGNED_OBJECT_ID = ParticipantEO.PARTICIPANT_ID(+)) QRSLT WHERE RuleAssignmentsEO.RULE_ID = :Bind_RuleId AND RuleAssignmentsEO.ORG_ID = :Bind_OrgId) "
    Edited by: Vik2 on Oct 23, 2012 11:30 AM

    invalid identifier means ,it representating that field currently not available in db-table.
    so please refer db-table. whether field avialable or not?.
    edited lately:
    djbo.debugoutput=console did you use this :) it will say the query is send to server.
    Edited by: user707 on Oct 22, 2012 11:58 PM

  • Parent-Child relation total

    i have 2 tables;
    Table 1
    Parent ID
    Parent Name
    Amount
    table 2
    DPND_CODE             
    DPND_NAME             
    DPND_RELAT_CODE       
    DPND_DOB              
    DPND_YN               
    DPND_SHARE_AMOUNT     
    DPND_BANK_CODE        
    DPND_BANK_AC_NO       
    DPND_AGENT_CODE       
    the query should check for the WHERE condition that dpnd_yn "Y"
    Parent ID       Parent Name        Amount
    001                emp1                   200.000
        001_01       emp1_chld1     50.000
        001_02       emp1_chld2     50.000
        001_03       emp1_chld3     50.000
        001_04       emp1_chld4     50.000
    .

    i was totally confused n hasty..Sorry to post with so incomplete info.
    actually i have a table that stores the total amount paid to an employee.
    for that my Table1 above serves the purpose.
    Table 1
    Parent ID
    Parent Name
    Amount
    the IInd table stores the distribution of the above (TABLE 1) total amount,
    to his family in case he has died. so the correct child table 2 struc is;
    table 2
    DPND_CODE             
    DPND_NAME             
    DPND_RELAT_CODE       
    DPND_DOB              
    DPND_YN               
    DPND_SHARE_AMOUNT     
    DPND_BANK_CODE        
    DPND_BANK_AC_NO       
    DPND_AGENT_CODE
    dpnd_PARENT_id  (Foreign key)
    and therefore the result that m looking for is;
    PARENT ID      PARENT NAME      AMOUNT
    001                emp1                   200.000 <------FROM TABLE 1
        dpnd_code  dpnd_name     dpnd_share_amount
        001_01       emp1_chld1     50.000  |
        001_02       emp1_chld2     50.000  |__FROM TABLE 2
        001_03       emp1_chld3     50.000  |
        001_04       emp1_chld4     50.000  |
    a condition should check whether dpnd_YN field = "Y",
    as all the next-of-kin members details of the deceased family is entered in the system at the time of his death.
    where as per rule only few qualify to get the share from the deceased pension as per policy.
    therefore the query should pick up only child records whom dpnd_YN IS MARKED As 'Y'.
    You've provided (3), but I don't know if that's really a good illustration of your problem.
    Do you have just one root (001), or can you have multiple roots (001, 002, 003, etc.)?
    Does the parent-child relationship go beyond two levels? (Thta is, can you have 001_01_01 or 001_01_02_03?)
    Yes the ROOT is always one, it will never go beyond two levels. (Just 001_01, 001_02...002_01, 002_02...003_01, 003_02..)
    Hope i am much better than before.
    ty
    Edited by: user613563 on Oct 27, 2008 3:01 PM
    Edited by: user613563 on Oct 27, 2008 3:05 PM

Maybe you are looking for