Parent - child relationship in a table

Oracle Database 10g Express Edition Release 10.2.0.1.0 - Product
I have the following table. The table contains a attribute called parentraid which specifies whether its a parent or a child. For the data given below, ra1,ra2,ra3 are parent and remaining are child with their respective parents specified in parentraid attribute.
CREATE TABLE  "ADDRESEARCHAREA"
   (     "RAID" VARCHAR2(30) NOT NULL ENABLE,
     "RANAME" VARCHAR2(30),
     "RASTARTDATE" DATE,
     "RAENDDATE" DATE,
     "PARENTRAID" VARCHAR2(30),
     "RASTATUS" VARCHAR2(30),
      PRIMARY KEY ("RAID") ENABLE
insert into addresearcharea values ('ra1','raname1',to_date('04/01/2012','mm/dd/yyyy'),'','','Active')
insert into addresearcharea values ('ra2','raname2',to_date('04/01/2012','mm/dd/yyyy'),'','','Active')
insert into addresearcharea values ('ra3','raname3',to_date('04/01/2012','mm/dd/yyyy'),'','','Active')
insert into addresearcharea values ('ra4','raname4',to_date('04/01/2012','mm/dd/yyyy'),'','ra1','Active')
insert into addresearcharea values ('ra5','raname5',to_date('04/01/2012','mm/dd/yyyy'),'','ra2','Active')I am looking for the following output,
RAID RANAME PARENTRAID PARENTRANAME
ra1 raname1 -  - 
ra2 raname2 -  - 
ra3 raname3 -  - 
ra4 raname4 ra1 raname1 
ra5 raname5 ra2 raname2  Please help

Hi,
Try this
SQL> CREATE TABLE  "ADDRESEARCHAREA"
  2     (       "RAID" VARCHAR2(30) NOT NULL ENABLE,
  3     "RANAME" VARCHAR2(30),
  4     "RASTARTDATE" DATE,
  5     "RAENDDATE" DATE,
  6     "PARENTRAID" VARCHAR2(30),
  7     "RASTATUS" VARCHAR2(30),
  8      PRIMARY KEY ("RAID") ENABLE
  9     );
Table created.
SQL>
SQL> insert into addresearcharea values ('ra1','raname1',to_date('04/01/2012','mm/dd/yyyy'),'','','Active');
1 row created.
SQL> insert into addresearcharea values ('ra2','raname2',to_date('04/01/2012','mm/dd/yyyy'),'','','Active');
1 row created.
SQL> insert into addresearcharea values ('ra3','raname3',to_date('04/01/2012','mm/dd/yyyy'),'','','Active');
1 row created.
SQL> insert into addresearcharea values ('ra4','raname4',to_date('04/01/2012','mm/dd/yyyy'),'','ra1','Active');
1 row created.
SQL> insert into addresearcharea values ('ra5','raname5',to_date('04/01/2012','mm/dd/yyyy'),'','ra2','Active');
1 row created.
SQL>
SQL>
SQL>
SQL>
SQL> select DISTINCT A.raid RAID,A.raname RANAME,A.parentraid PARENTRAID,
  2  case when A.parentraid=B.raid then A.raname else null end PARENT_NAME
  3  from ADDRESEARCHAREA A LEFT JOIN ADDRESEARCHAREA B ON (A.parentraid=B.raid) ORDER BY RAID ASC ;
RAID RANAME  PARE PARENT_NAME
ra1  raname1
ra2  raname2
ra3  raname3
ra4  raname4 ra1  raname4
ra5  raname5 ra2  raname5
SQL>
SQL>Edited by: Chanchal Wankhade on Oct 8, 2012 11:41 PM
Edited by: Chanchal Wankhade on Oct 8, 2012 11:41 PM

Similar Messages

  • Parent Child Relationship in the table to be queried.

    Hi guys,
    I have the below query.
    Table 1:
    Column_name Reference
    Value1 Value1
    Value2 Value1
    Table 2:
    Column_name Attributes(child Elements)
    Value1 Child1
    Value1 Child2
    Now my query is to retrieve records as below using both the tables.
    Value1
    Value1.Child1
    Value1.Child2
    Value2
    Value2.Child1
    Value2.Child2
    How can I get such ?
    Regards,
    SQL Developer.

    Hi,
    As Alex said, you should have tried by joining them.
    With Parent As (
    select 'Value1' p_col1,'Value1' P_col2 from dual union all
    select 'Value2','Value1' from dual),
    child as (
    select 'Value1' c_col1,'Child1' c_col2 from dual union all
    select 'Value1','Child2' from dual)
    -- End of sample data
    select p_col1,null c_col2 from parent
    union
    select p_col1,c_col2 from parent,child
    where p_col2=c_col1
    order by p_col1,c_col2 desc
    PRAZY@11gR1> /
    P_COL1 C_COL2
    Value1
    Value1 Child2
    Value1 Child1
    Value2
    Value2 Child2
    Value2 Child1
    6 rows selected.
    Elapsed: 00:00:00.03Regards,
    Prazy

  • Does table STPOX contain parent-child relationship between components

    Hello
    I need to get a list of components of SO BOM.
    FM CS_BOM_EXPL_KND_V1 exports an output table STPOX.
    Does this table contain parent-child relationship between components? If yes , can somebody tell me which fields contain parent child id.
    thanks

    Hi,
    STPOX is not a table, it is a structure & hence there is no storing of data in a structure. The table which stores this info is STPO.
    To get the link you can refer to STPO-STLNR & pass this value to MAST-STLNR, this way you can link the child with its parent.
    Regards,
    Vivek

  • Help needed in retrieving parent child relationship values

    Hi,
    I have a requirement to get parent child relationship values as below.
    Ex: Address table
    cont cont_code state state_code
    C1 10 S1 1
    C1 10 S2 2
    C1 10 S3 3
    C2 20 S4 4
    C2 20 S5 5
    C3 30 S6 6
    C3 30 S7 7
    C3 30 S8 8
    I want a result of country/state and corresponding code like below.
    corresponding states should be displayed under each country with some space appended to it.
    Geography code
    C1 10
    S1 1
    S2 2
    S3 3
    C2 20
    S4 4
    S5 5
    C3 30
    S6 6
    S7 7
    S8 8
    I am using oracle 10g version.
    Thanks in advance.

    Hi,
    When you post formatted text (like your output) on this site, type these 6 characters:
    \(small letters only, inside curly brackets) before and after each section of formatted text, to preserve spacing.
    I think you're saying that you want this output:GEOGRAPHY CODE
    C1 10
    S1 1
    S2 2
    S3 3
    C2 20
    S4 4
    S5 5
    C3 30
    S6 6
    S7 7
    S8 8
    If so, UNION, as Hoek suggested, is a good way.
    GROUP BY ROLLUP is more efficient, but harder to understand:SELECT     CASE
              WHEN GROUPING (state) = 1
              THEN cont
              ELSE ' ' || state
         END          AS geography
    ,      CASE
              WHEN GROUPING (state) = 1
              THEN MAX (cont_code)
              ELSE MAX (state_code)
         END          AS code
    FROM     t
    GROUP BY cont
    ,      ROLLUP (state)
    ORDER BY cont
    ,      state          NULLS FIRST
    By the way, this looks like a bad table design.
    In a relational database, the fact that the name 'C1' belongs to cont_code 10 should only be stored in one place.  You have the same information on 3 separate rows.
    Also, if 'C1' and 'S1' are both names, they should probably be in the same column, so that (to give just one example) you can find the information about 'x1' without knowing if it is a cont or a state.
    A better design would be.NAME     CODE     PARENT     DSCR
    ====     ====     ======     ====
    C1     10          CONT
    S1     1     10     STATE
    S2     2     10     STATE
    S3     3     10     STATE
    C2     20          CONT
    S4     4     20     STATE
    S5     5     20     STATE
    C3     30          CONT
    S6     6     30     STATE
    S7     7     30     STATE
    S8     8     30     STATE
    If the data is this simple, then the dscr column isn't needed.  Whether parent is NULL or not tells whether the rows represents a cont or a state.
    To get the results you want from a table like this, you could use CONNECT BY.  Using either UNION or ROLLUP, you have to know, at the time you write the query, how many levels there will be in the parent-child tree, and the length of the code is proportional to that depth, and the table has to be changed if you ever need to add another level.  CONNECT BY can handle any number of levels, and the length and complexity of the code is the same whether you have just 2 levels (countries and strates), or 7 levels (continents, regions, countiries, states, districts, cities and neighborhoods) or 72 levels.  The table doesn't need any more columns, no matter how deep the tree gets.
    Edited by: Frank Kulash on Sep 16, 2010 11:54 AM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Parent child relationship is not displaying for IDOC_OUTPUT_ORDERS (PO)

    Hi,
    Can somebody help me the reason why parent child relationship not displaying properly for ORDER05 basic type?
    If we go in details about the problem, a purchase order is creating in R/3 through EBP. To modify my requirement I am using userexit EXIT_SAPLEINM_002. Here I am appending the records in the segment for E1EDKT1 and E1EDKT2. IDOC is creating with an error of status record 26.
    When I check in the transaction WE19 for the respective IDOC the data is showing correctly for all the segments including e1edkt1 and e1edkt2 segments and also I check in the table EDID4 segment number is showing correctly and the for the segment E1EDKT2 PGNUM also showing correctly, but when I see the IDOC in the transactions WE02 unable to see parent child relationship between E1EDKT1 and E1EDKT2 segment. Simply the data is displaying one below other like other segment.
    I don't know the reason why it is displaying like that?
    If anybody is having the solution is highly appreciable.
    Regards,
    Noorul

    hi hassan,
    When you are appendng the REcods which belong to the purticular segment..
    all the segment needs to be appended in in the proper order as in the WE30..
    I<b> think you are appending the segment E1EDKT2 at the end of the EDIDD.. or IDOC_DATA in the user exit..</b> .. eventho no eerror will be displayed but idoc will generted with sataus 26 .. if check the <b>STATUIs Recored u ewill find the SYNTaX ERROR.</b>
    <b>Sollution for ur probelm is</b>... don append the E1EDKT2 at the lastr instead <b>you ahve to insert the segment E1EDKT2. only afer E1EDKT1..</b>..
    Tehn you r problem will be solved.. I had faced the Same proble when i worked on material maser idoc..
    <b>Close this thread if when u r problem ise solved</b>
    Reward if helpful
    Regards
    Naresh Reddy K

  • How to use GL Parent Child relationships in Discoverer?

    Subject: How to used GL Parent Child relationships in Discoverer?
    How to use GL Parent Child relationships in Discoverer?
    Please let me know how to incorporate the parent -child relation ships exsiting in GL Accouting flexfield Segments in Discoverer for drill downs? we have GL - BIS views installed.
    How to create the specific Parent -child relationship hierarchies in Discoverer from the FND_* tables?
    Please help.
    Thanks.
    KS.

    Hi,
    I'm also trying to implement this. If you have come any further in solving this any hints would be much appreciated...
    regards,
    AJ

  • Parent-Child Relationships in Essbase Studio

    In Essbase Studio, I am defining a hierarchy in which a parent member (Wholesaler) is from one dimension table and child member (Rep) is from another. When I preview this hierarchy or build an outline to include it, a few of the Reps that should rollup to a certain Wholesaler are missing. They are not dropped, but Essbase Studio just never recognizes these Reps as being children of that Wholesaler in the first place. However, if I run a sql query against the source data mart with the correct joins, these missing reps do show up in the records of that Wholesaler. Also, the missing Reps are showing up fine in the hierarchy preview as long as I don't make them children of anything in the Wholesaler dim. So Essbase Studio is able to see these Reps, but just can't figure out how they are related to the given Wholesaler. Again, this is only happening for about 10% of the Reps for the Wholesaler. Other Reps are showing up fine in the parent-child relationship.
    In the source data mart, I don't see any NULLs or anything amiss in the records for the missing Reps. What other reasons would Essbase Studio not recognize a particular joined record?

    it really does sound like a join issue. You say if you just load the children without the parent, they load, but if you associte them to the parent, they don't. You might try when creating the joins to do a full outter join to see if they load and to what.
    One other thing you could try would be to create a user defined table that has the join in it. I've found data atype issues in joins from different tables before. Studio is very pickey about this
    Edited by: GlennS_3 on Oct 20, 2010 9:12 AM

  • Implement Parent child Relationship using SSIS

    Could you please suggest the best way which should not impact the performance of data loading, to implement parent child relationship using SSIS.
    We have a flat file RECON80.dat which need to be loaded into the database into 2 tables.
    Parent Table JobMaster  and Child Table RECON80 .
    In the flat file we have a fields Jobphase which will get inserted in JobMaster table and the remaning details like EIN, DATE etc will get inserted in RECON80 table.
    The Parent table JobMaster has JobId as an identity column which is the Pk of the table and it will get inserted into the child table i.e RECON80 JobId as FK of the child tale.
    Please suggest the best possible way to achieve it.

    Hi SubhadipRoy, I think you might need to create a procedure for this task.
    Because in SSIS, we cannot directly get the Identity ID.
    As my experience, there were serveral ways to do. But all are workaround.
    So, My suggestion is.
    In SSIS:
    1. Create a DataFlow
    2. Drag a flat source and load the data from dat file
    3. Create a procedure which receive the parameter from your data of each row.
    4. Drag a OLEDBCommand to the Panel and Invoke the Procedure also don't forget to pass all your rows to the Procedure in OLEDBCommand control.
    5. In Procedure, after insert 1 row you could get the Identity ID throuth SCOPE_IDENTITY()
    That's it, hope it works for you even this may not the efficency way.
    Althrough, I expect someone can give the best way if there is.

  • EJB 3, OneToMany that Acts As Tree, or Parent Child relationship support?

    (Sorry for the RoR reference)
    I first searched the forum and found this post that came close, but not exactly what I'm needing since my table doesn't reference the PK:
    http://forum.java.sun.com/thread.jspa?forumID=13&threadID=767913
    I have a table called Folder that represents a folder hierarchy. It has a 'Path' field and a 'Parent' field, and of course 'ID'. Each Folder knows its parent by the 'Parent' field, which references 'Path', not* 'ID'. Both are Strings.
    To find all the children of a Folder, the sql for a PreparedStatment might look something like this (shared for clarity of the situation):
    SELECT * FROM Folder
    WHERE Parent = ?Question:
    What are the proper annotations in EJB 3 / JPA to allow this kind non-primary key parent/child relationship mapping?
    Can I specify a named query that handles the logic and then reference it in the OneToMany annotation? Other cool tricks?
    Here is what I am trying (no runtime errors, but no results either). (Example simplified)
    @Entity
    @Table(name = "Folder")
    @NamedQueries(value = {@NamedQuery(.......)})
    public class Folder implements Serializable {
        @Id
        @Column(name = "ID", nullable = false, updatable = false)
        private Integer folderID;
        @Column(name = "Path", nullable = false)
        private String path;
        @Column(name = "Parent")
        private String parent;
        // v Here's the kicker v
        @OneToMany(cascade={CascadeType.ALL}, fetch=FetchType.EAGER)
        @JoinTable(name="Folder",
            joinColumns={@JoinColumn(name="Parent")},
            inverseJoinColumns={@JoinColumn(name="Path")})
        private List<Folder> children;
        // getters and setters ....
    }Thanks!

    It looks like the relationship is bi-directional.
    Will this work...
    // Parent.java
    @Entity
    public class Parent implements java.io.Serializable {
    @Id
    public Long parentId;
    @OneToMany(cascade=CascadeType.PERSIST,mappedBy="parent")
    public Collection<Child> children;
    // Child.java
    @Entity
    public class Child implements java.io.Serializable {
    @Id
    public Long childId;
    @ManyToOne
    public Parent parent;  // target of mappedBy
    }Then, in your code (a session facade?), you'll create the parent first, create the children, then add the children to the parent. Your code is also responsible for maintaining the reference back to the parent.
    Parent p = new Parent();
    for(int i=0; i<10; i++) {
      Child c = new Child();
      p.children.add(c);
      c.parent = p;
    em.persist(p);

  • Function to get the path using a parent-child relationship

    Hello,
    I have a table which uses parent-child relationship to store the options available. I need a function to give me the full path given the id of a particular option.
    I have two different functions. One of them uses the Oracle built in function and the other uses simple queries with a loop.The code of the functions are given below.
    Now, the problem is with their "performance". The difference in their performance is significant. The function using the Oracle function takes more than 2 hours to run a query whereas the other function takes less than 2 minutes.
    I am having trouble trusting the other function. No matter how many tests I perform on the output of both the functions, it always comes out to be the same.
    Any thoughts to help me understand this ??
    Function 1
    =====================
    FUNCTION Gettree (opt_id IN NUMBER,i_app_id IN NUMBER)
    RETURN VARCHAR2
    IS
    path VARCHAR2(32767);
    application_no NUMBER;
    BEGIN
    SELECT ABC.APP_OPT_ID INTO application_no FROM ABC
    WHERE ABC.APP_ID = i_app_id AND ABC.PARENT_ID IS NULL;
    SELECT LPAD(' ', 2*LEVEL-1)||SYS_CONNECT_BY_PATH(app_opt_name, '=>') "Path" INTO path
    FROM ABC
    WHERE app_opt_id = opt_id
    START WITH parent_id =application_no
    CONNECT BY PRIOR app_opt_id =parent_id;
    path := SUBSTR(path,INSTR(path,'>')+1,LENGTH(path));
    RETURN path;
    END Gettree ;
    Function 2
    ======================
    FUNCTION GetOptPath(opt_id NUMBER,app_id NUMBER)
    RETURN VARCHAR2
    IS
    string VARCHAR2(900);
    opt VARCHAR2(100);
    pid NUMBER(38);
    BEGIN
    SELECT ABC.parent_id,ABC.app_opt_name INTO pid,string FROM ABC WHERE ABC.app_opt_id = opt_id;
    IF pid IS NULL
    THEN
    RETURN 'root';
    ELSIF pid IS NOT NULL
    THEN
    LOOP
    SELECT ABC.app_opt_name,ABC.parent_id INTO opt, pid FROM ABC WHERE ABC.app_opt_id = pid;
    EXIT WHEN pid IS NULL;
    string := opt || '=>'|| string;
    END LOOP;
    RETURN string;
    END IF;
    END;

    Hi,
    user8653480 wrote:
    Hello Frank,
    The parameters taken by gettree & getoptpath are app_opt_id and app_id and both the functions return only one string i.e. the path of that particular option (app_opt_id) starting from its root and not all the descendants of that option/root node of that option.
    So, does that mean that gettree first fetches all the descendants of the root node of the given option and then returns the required one ??Yes. It's a little like the situation where you need to meet with your co-worker Amy, so you send an e-mail to everyone in the department telling them to come to your office, and then, when they arrive, tell everyone except Amy that they can leave.
    >
    And if that is the case, then won't it be better to use the bottom-up approach to fetch the required path just for that particular option ?? 'coz my requirement is that only.. given an option_id get the full path starting from the root.Exactly!
    I have used explain plan also for both the functions.. but since I did not know how to anlayze the output from plan_table so I just compared the value in the fields and they were exactly the same for both the queries.If you'd like help analyzing the plans, post them, as Centinul said.
    I am attaching a sample data with the outputs of both the functions for the reference.
    (tried attaching the file but could not find the option, so pasting the data here)
    App_opt_ID     App_ID     Parent_ID     App_opt_name     "gettree(app_opt_id,app_id)"     "getoptpath(app_opt_id,app_id)"
    1          1     NULL          application          NULL                    root
    2          1     1          module1               module1                    module1
    3          1     1          module2               module2                    module2
    4          1     2          submod1               module1=>submod1          module1=>submod1
    5          1     3          submod1               module2=>submod1          module2=>submod1
    6          1     5          opt1               module2=>submod1=>opt1          module2=>submod1=>opt1
    7          2     NULL          app2               NULL                    root
    8          2     7          scr1               scr1                    scr1
    9          2     8          opt1               scr1=>opt1               scr1=>opt1
    10          2     7          scr2               scr2                    scr2Please help.The best solution is to do a bottom-up query, and write a function like reverse_path (described in my first message) to manipulate the string returned by SYS_CONNECT_BY_PATH. You seem to have all the PL/SQL skills needed for this.
    Another approach is a revised form of gettree, like I posted earlier. Does it do what you want or not?
    If you'd help, then post a little sample data in a form people can actually use, such as CREATE TABLE and INSERT statements. Post a few sets of parameters, and the results you need from each set, given the sample data posted.

  • Master Detail - Detail parent child relationship

    Hello All,
    I have a setup where I have 3 tables. Call them A, B, and C. Table A is the parent table to the child table B. Also table B is the parent table to the Child table C. Is there a way to represent this in Apex? So far I have created two Master Detail forms: Master Detail form one has the relationship A+B and Master Detail form two has the relationship B+C. Can Apex support a Master Detail Detail form.
    Also, is there a way to have my detail page editable without linking to another page to save and update?
    Please let me know what everyone thinks.
    Thanks
    Ryan

    Hi,
    You can google it - so much information is available online. Any how
    Parent Child relationship
    PK FKBasic example - Parent and Child in real life -similarly the Table_A is having relation with some other Table_B.
    Example
    Table_A
    columns :-
    Student_No, Student Name, Student_address
    Now the Table_B store the assignment details
    Student_No, Subject_1,subject_2, subject_3
    Now relation of join is Table_A.Student_No = Table_B.Student_No
    With out the TAble_A details -can be identified the Sudent details etc., No - It's Master data - which is not dependent on any other table and Column Student_No- Acts Primary Key which is Unique -through which we can identify a specific details of particular student. Now comes to Table_B - with out the student_No - we can't say whose details of assignments belongs to whom - now the student_No in Table_B is dependent on some other table - now this table acts a child and Primary Key of Table_A acts Foreign Key - that column helps to identify the record.
    Master Detail
    Reference tablesconcept of understanding is same when - when comes c,c++, java and c sharp - acts the same but inheritance, interfaces, polymorphisms and overloading code of language differs. If you go further j2ee differs
    HTH
    - Pavan Kumar N
    Oracle 9i/10g - OCP
    http://oracleinternals.blogspot.com/

  • Parent Child relationship in PO

    Hi All
       I want to know what are the tables where parent child relationship of a PO is stored.
    Points guranteed
    Thanks in anticipation.

    EKKO for Header & EKPO for Items.
    EKET can be considered as well for schedule lines and EKBE for Transaction History.
    Regards
    Eswar

  • Find parent/child relationships At More Than 2 Levels

    Hello,
    Does anyone have a solution to find parent/child relationship for data more than 2 levels deep?
    I have a solution when there's a simple parent-child relationship but not when there's a grandparent-parent-child relationship or deeper.
    Ex. I have a table company_parent_child that stores the relationship betwen a company and it's direct parent.
    create table TEMP_COMPANY_PARENT_CHILD
    PARENT_ID NUMBER(10),
    COMPANY_ID NUMBER(10)
    insert into TEMP_COMPANY_PARENT_CHILD values (1, 10);
    insert into TEMP_COMPANY_PARENT_CHILD values (1, 11);
    insert into TEMP_COMPANY_PARENT_CHILD values (1, 12);
    insert into TEMP_COMPANY_PARENT_CHILD values (2, 13);
    insert into TEMP_COMPANY_PARENT_CHILD values (10, 100);
    insert into TEMP_COMPANY_PARENT_CHILD values (10, 101);
    insert into TEMP_COMPANY_PARENT_CHILD values (10, 102);
    insert into TEMP_COMPANY_PARENT_CHILD values (11, 103);
    1->
    ___10->
    ______100,101,102,
    ___11->103
    Companies 100, 101 and 102 are under parent 10 and grandparent 1.
    I need to create such a view or another temp table so that when I pass the parent ID, I will pull all the children on all levels. In addition, and this is the tricky part, when I join this new temp table or view to another data table without any parameters, the data should not be duplicate, ie. each company ID should appear only once.
    create table TEMP_JOIN
    company_id number(10),
    order_id varchar2(10)
    insert into TEMP_JOIN values (100, 'a');
    insert into TEMP_JOIN values (101, 'b');
    insert into TEMP_JOIN values (102, 'c');
    insert into TEMP_JOIN values (103, 'd');
    insert into TEMP_JOIN values (10, 'e');
    insert into TEMP_JOIN values (11, 'f');
    insert into TEMP_JOIN values (12, 'e');
    insert into TEMP_JOIN values (13, 'f');
    Thanks.

    start by learning CONNECT BY/START WITH. once you've
    written a query to read the grandparent-parent-child
    relationship, then come back with more questionsYes. we did look heavily into connect by/start with, in fact along with "connect_by_iscycle","connect_by_isleaf","connect_by_root" as well.
    Our dilemma is that when a joint is made between those two tables mentioned above TEMP_COMPANY_PARENT_CHILD and TEMP_JOIN, we are not able to create a view that would contain distinct company_ids, each mapped to a unique order id.
    The problem is we cannot have this type of joint when there are "n" level relationship between companies (or company_id). Basically, I think we should have our unique order id mapped to a unique key. This unique key should be a specialized key that we can know at anytime the entire path of the ancestry which we can know by sys_connect_by_path(company_id,'/') path.
    How do we know which path to take. The best bet is to "connect_by_isleaf" and just have the distinct "deep" path which form the specialized unique key. If you need help on this let me know. (A hint, sort by LEVEL and then do a rank after partitioning by company id and then filter the records by rank = 1, try this one!!!)
    So, we will eventually have a joint (say Table X) like
    PATH ORDER_ID
    /1/10/100 a
    /1/10/101 b
    /1/10/102 c
    /1/10 e
    /1
    /1/11/103 d
    /1/11 f
    I think this is the best view we can have to maintain a joint with no repetition along PATH as well as ORDER_ID. If you have any other thoughts, let me know.
    Then you query by path using INSTR to pull records by company_id.
    for example, if you want to get all the children for company_id "10" you would just say
    select * from X where INSTR(PATH,10,1,1) <> 0
    or if you want to get all the children for company_id "11" you would just say
    select * from X where INSTR(PATH,11,1,1) <> 0
    What do you think? Has anyone used the path information for traversing the tree? Or is there any article that tells us how to make effective use of sys_connect_by_path(company_id,'/') path.
    Thank you. Hope it made sense!

  • Circular Parent-Child relationship among widgets.

    I am trying to draw a Bar Graph on a panel which in turn sits on the main
    window. The height policy of the panel widget is set to SP_TO_PARENT so that
    when the window is resized the panel is also resized according to the parent
    window. I have a situation that every time the panel is resized I need to
    scale the Bar Graph in accordance with the new panel size and draw it. But
    before drawing the newly scaled Bar Graph I am clearing out all the children
    of the panel ( I am doing this just to refresh the panel) and then drawing
    the newly scaled Bar Graph. But this does not work!!! I still find some
    left over from the previous Bar Graph!!! Any help in this matter is greatly
    appreciated.
    Also I don't understand this circular parent-child relationship. If I assign
    a NIL to Parent attribute of all the children of the panel, what will happen
    to the Children attribute of the panel? Won't there be any memory leak by
    adopting the above procedure of disconnecting a child from its parent? If
    so, how do we take care of it?
    Thanks in advance!
    Alaiah Chandrashekar
    The following is the segment of the code which could be useful for clarity:
    // Draws the Bar Graph for the first time.
    self.ShowChart(TestData);
    self.Open();
    event loop
    when task.Shutdown do
    exit;
    // When the window is resized
    // I am scaling the Bar Graph for the new
    // panel size.
    when self.window.AfterReSize do
    self.ClearChartPanel();
    // self.window.UpdateDisplay();
    self.ShowChart(TestData);
    end event;
    self.Close();
    Method ClearChartPanel is as follows:
    for child in self.<ChartPanel>.Children do
    child.Parent = NIL;
    end for;

    Hello Evandro,
    I am listing the steps to create a relationship manually.
    1. Create 2 records in the relationship table in console, one for "Married to" and the other one for "Owner". In order to do that the repository needs to be unloaded.
    2. Once you create these 2 records in the table through console, load the repository.
    3. Log on to the Data Manager.
    4. Now as per your example, there are 3 records in the main table, namely
         JOHN
         MARY
         ACME
    5. Select only one record in the record list area e.g. JOHN (where you see the list of records)
    6. Then, in the record edit area, double click on the relationship tab,
    7. New Window opens up.
    8. HERE ALL THE OPTIONS ARE GRAYED OUT. But Select the relationship which you want to create, in our case married to.
    9. Now select the record MARY in the record list area. (NOT in the pop window, but main window).
    10. Then on the top bar menu, select Relationships --> Adds to Group.
    11. Now close the Pop window and observe that the relationship has been created between JOHN and MARY.
    Let me know if it worked for you. if not, post some more information about your problem such as where you tried to configure and what options were grayed out.
    Please update.
    Thanks
    Shai
    I need to do a relationship among the BP where each record in Main Table correspond a BP (Person or Organization).
    The relationship should link the BPs as shown below:
    Records
    1; John
    2; Mary
    3; ACME
    In record 1, I need to say that John is married with Mary, where Married is a type of the relationship and that Mary is Owner of the ACME, where u201COwneru201D is other relationship type.
    I have tried to configure a Relationship (where the parent and child tables were the Main Table) in MDM, but I couldnu2019t to do it because the screen for this feature was locked. I need to be certified that the child link exist in the repository.
    Thank you.
    Evandro.

  • Recursive Parent Child relationship in JPA

    @Entity
    @Table(name = "OBJECTCATEGORY")
    public class ObjectCategory implements Serializable {
         @Id
         private String categoryId;
         private String categoryName;
         private String description;
         private static final long serialVersionUID = 1L;
         @ManyToMany(fetch = FetchType.EAGER)
         @JoinTable(name = "MAP_CATEGORY", joinColumns = @JoinColumn(name = "CATEGORYID"), inverseJoinColumns = @JoinColumn(name = "OBJECTID"))
         private List<MapC> mapList = new ArrayList<MapC>();
    // Recursion
         @OneToMany(fetch = FetchType.LAZY, mappedBy = "fqQuesCatagory")
         List<ObjectCategory > categoryList = new ArrayList<ObjectCategory>();
         @ManyToOne
         @JoinColumn(name = "PARENTCATEGORY")
         private ObjectCategory fqQuesCatagory
    // Recursion
         public FqQuesCatagory() {
              super();
         public String getCategoryname() {
              return this.categoryname;
         public void setCategoryname(String categoryname) {
              this.categoryname = categoryname;
         public String getDescription() {
              return this.description;
         public void setDescription(String description) {
              this.description = description;
         public List<MapC> getMapList() {
              return faqList;
         public void setFaqList(List<MapC> faqList) {
              this.mapList = mapList ;
         public String getCategoryid() {
              return categoryId;
         public void setCategoryid(String categoryid) {
              this.categoryid = categoryId;
         public List<ObjectCategory> getFqCategoryList() {
              return categoryList;
         public void setFqCategoryList(List<ObjectCategory> categoryList) {
              this.categoryList = categoryList;
         public ObjectCategory getFqQuesCatagory() {
              return fqQuesCatagory;
         public void setFqQuesCatagory(ObjectCategory fqQuesCatagory) {
              this.fqQuesCatagory = fqQuesCatagory;
    Doesn't SAP JPA support recursive parent-child relationship (highlighted by "// Recursion"). The same model works in TopLink perfectly.

    Sorry for the delayed update..
    I see an issue in the WSNavigator. I have a method in my EJB exposed as a web service. This method has a single argument, which is a serializable class containing a few string variables and the above-mentioned Entity with suitable getters and setters for all the class variables.
    When I try to select this operation under the WSDL in the Webservice Navigator, I get a stack overflow error. I think it is because WD4J run-time is not able to build the nested tree. Not sure though...I've attached the stack trace below:
    Cannot send an HTTP error response [500 "Application error occurred during the request procession." (details: java.lang.StackOverflowError
    at java.lang.String.lastIndexOf(String.java:1496)
    at java.lang.String.lastIndexOf(String.java:1458)
    at com.sap.dictionary.runtime.StringUtil.getPackageName(StringUtil.java:143)
    at com.sap.dictionary.runtime.DdBroker.getDataType(DdBroker.java:179)
    at com.sap.tc.webdynpro.progmodel.context.DictionaryHandler._getScalarType(DictionaryHandler.java:447)
    at com.sap.tc.webdynpro.progmodel.context.DictionaryHandler.getDataType(DictionaryHandler.java:159)
    at com.sap.tc.webdynpro.progmodel.context.DataAttributeInfo.init(DataAttributeInfo.java:447)
    at com.sap.tc.webdynpro.progmodel.context.NodeInfo.addAttribute(NodeInfo.java:746)
    at com.sap.tc.webdynpro.progmodel.context.NodeInfo.addAttribute(NodeInfo.java:759)
    at com.sap.esi.esp.wsnavigator.helper.DWSContextBuilder.createParameterNodeInfo(DWSContextBuilder.java:984)
    at com.sap.esi.esp.wsnavigator.helper.DWSContextBuilder.access$400(DWSContextBuilder.java:88)
    at com.sap.esi.esp.wsnavigator.helper.DWSContextBuilder$DInputParams.buildContextForComplexType(DWSContextBuilder.java:1591)
    at com.sap.esi.esp.wsnavigator.helper.DWSContextBuilder$DInputParams.buildContextForTypeObject(DWSContextBuilder.java:1574)
    at com.sap.esi.esp.wsnavigator.helper.DWSContextBuilder$DInputParams.createElementObject(DWSContextBuilder.java:1763)
    at com.sap.esi.esp.wsnavigator.helper.DWSContextBuilder$DInputParams.createFieldObject(DWSContextBuilder.java:1681)
    at com.sap.esi.esp.wsnavigator.helper.DWSContextBuilder$DInputParams.intWithStructureFields(DWSContextBuilder.java:1671)
    at com.sap.esi.esp.wsnavigator.helper.DWSContextBuilder$DInputParams.createComplexTypeObject(DWSContextBuilder.java:1660)
    at com.sap.esi.esp.wsnavigator.helper.DWSContextBuilder$DInputParams.buildContextForComplexType(DWSContextBuilder.java:1615)
    at com.sap.esi.esp.wsnavigator.helper.DWSContextBuilder$DInputParams.buildContextForTypeObject(DWSContextBuilder.java:1574)
    at com.sap.esi.esp.wsnavigator.helper.DWSContextBuilder$DInputParams.createElementObject(DWSContextBuilder.java:1763)
    at com.sap.esi.esp.wsnavigator.helper.DWSContextBuilder$DInputParams.createFieldObject(DWSContextBuilder.java:1681)
    at com.sap.esi.esp.wsnavigator.helper.DWSContextBuilder$DInputParams.intWithStructureFields(DWSContextBuilder.java:1671)
    at com.sap.esi.esp.wsnavigator.helper.DWSContextBuilder$DInputParams.createComplexTypeObject(DWSContextBuilder.java:1660)
    at com.sap.esi.esp.wsnavigator.helper.DWSContextBuilder$DInputParams.buildContextForComplexType(DWSContextBuilder.java:1615)
    at com.sap.esi.esp.wsnavigator.helper.DWSContextBuilder$DInputParams.buildContextForTypeObject(DWSContextBuilder.java:1574)
    at com.sap.esi.esp.wsnavigator.helper.DWSContextBuilder$DInputParams.createElementObject(DWSContextBuilder.java:1763)
    at com.sap.esi.esp.wsnavigator.helper.DWSContextBuilder$DInputParams.createFieldObject(DWSContextBuilder.java:1681)
    at com.sap.esi.esp.wsnavigator.helper.DWSContextBuilder$DInputParams.intWithStructureFields(DWSContextBuilder.java:1671)
    at com.sap.esi.esp.wsnavigator.helper.DWSContextBuilder$DInputParams.createComplexTypeObject(DWSContextBuilder.java:1660)
    at com.sap.esi.esp.wsnavigator.helper.DWSContextBuilder$DInputParams.buildContextForComplexType(DWSContextBuilder.java:1615)
    at com.sap.esi.esp.wsnavigator.helper.DWSContextBuilder$DInputParams.buildContextForTypeObject(DWSContextBuilder.java:1574)
    at com.sap.esi.esp.wsnavigator.helper.DWSContextBuilder$DInputParams.createElementObject(DWSContextBuilder.java:1763)
    at com.sap.esi.esp.wsnavigator.helper.DWSContextBuilder$DInputParams.createFieldObject(DWSContextBuilder.java:1681)
    at com.sap.esi.esp.wsnavigator.helper.DWSContextBuilder$DInputParams.intWithStructureFields(DWSContextBuilder.java:1671)
    at com.sap.esi.esp.wsnavigator.helper.DWSContextBuilder$DInputParams.createComplexTypeObject(DWSContextBuilder.java:1660)
    at com.sap.esi.esp.wsnavigator.helper.DWSContextBuilder$DInputParams.buildContextForComplexType(DWSContextBuilder.java:1615)
    at com.sap.esi.esp.wsnavigator.helper.DWSContextBuilder$DInputParams.buildContextForTypeObject(DWSContextBuilder.java:1574)
    at com.sap.esi.esp.wsnavigator.helper.DWSContextBuilder$DInputParams.createElementObject(DWSContextBuilder.java:1763)
    at com.sap.esi.esp.wsnavigator.helper.DWSContextBuilder$DInputParams.createFieldObject(DWSContextBuilder.java:1681)
    at com.sap.esi.esp.wsnavigator.helper.DWSContextBuilder$DInputParams.intWithStructureFields(DWSContextBuilder.java:1671)
    at com.sap.esi.esp.wsnavigator.helper.DWSContextBuilder$DInputParams.createComplexTypeObject(DWSContextBuilder.java:1660)
    at com.sap.esi.esp.wsnavigator.helper.DWSContextBuilder$DInputParams.buildContextForComplexType(DWSContextBuilder.java:1615)
    at com.sap.esi.esp.wsnavigator.helper.DWSContextBuilder$DInputParams.buildContextForTypeObject(DWSContextBuilder.java:1574)
    at com.sap.esi.esp.wsnavigator.helper.DWSContextBuilder$DInputParams.createElementObject(DWSContextBuilder.java:1763)
    at com.sap.esi.esp.wsnavigator.helper.DWSContextBuilder$DInputParams.createFieldObject(DWSContextBuilder.java:1681)
    at com.sap.esi.esp.wsnavigator.helper.DWSContextBuilder$DInputParams.intWithStructureFields(DWSContextBuilder.java:1671)
    at com.sap.esi.esp.wsnavigator.helper.DWSContextBuilder$DInputParams.createComplexTypeObject(DWSContextBuilder.java:1660)
    at com.sap.esi.esp.wsnavigator.helper.DWSContextBuilder$DInputParams.buildContextForComplexType(DWSContextBuilder.java:1615)
    at com.sap.esi.esp.wsnavigator.helper.DWSContextBuilder$DInputParams.buildContextForTypeObject(DWSContextBuilder.java:1574)
    at com.sap.esi.esp.wsnavigator.helper.DWSContextBuilder$DInputParams.createElementObject(DWSContextBuilder.java:1763)
    at com.sap.esi.esp.wsnavigator.helper.DWSContextBuilder$DInputParams.createFieldObject(DWSContextBuilder.java:1681)
    at com.sap.esi.esp.wsnavigator.helper.DWSContextBuilder$DInputParams.intWithStructureFields(DWSContextBuilder.java:1671)
    at com.sap.esi.esp.wsnavigator.helper.DWSContextBuilder$DInputParams.createComplexTypeObject(DWSContextBuilder.java:1660)
    at com.sap.esi.esp.wsnavigator.helper.DWSContextBuilder$DInputParams.buildContextForComplexType(DWSContextBuilder.java:1615)
    at com.sap.esi.esp.wsnavigator.helper.DWSContextBuilder$DInputParams.buildContextForTypeObject(DWSContextBuilder.java:1574)
    at com.sap.esi.esp.wsnavigator.helper.DWSContextBuilder$DInputParams.createElementObject(DWSContextBuilder.java:1763)
    at com.sap.esi.esp.wsnavigator.helper.DWSContextBuilder$DInputParams.createFieldObject(DWSContextBuilder.java:1681)
    at com.sap.esi.esp.wsnavigator.helper.DWSContextBuilder$DInputParams.intWithStructureFields(DWSContextBuilder.java:1671)
    Any thoughts on this will be highly appreciated.
    BR.

Maybe you are looking for

  • How can I see Calendar event END times at a glance?

    How can I display my Calendar event titles exactly as I type them? I do not want Calendar to remove duration from the titles of my events. Otherwise I can't see event END times at a glance in month view; only start times. How can I "trick" Calendar t

  • Problems adding and removing dual monitor

    using FCE to do some light editing at work. continually need to flip between a single and dual monitor setup due to other things i need to do on a different computer. having problem with FCE not moving all windows back to the main monitor after remov

  • I have the Insurance Plan..but old Phone (Samsung Saga I-770)

     I've had insurance for 2 years. It looks like they don't even sell that model on the Verizon Website or store. It's been lost, will Verizon send me the exact same model  or give me a choice for replacement?

  • How to fix rebate accrual accounts not clearing when rebate paid?

    Automatic clearing of the rebate accrual accounts fails. The credits are created by the rebate accrual functionality. When the rebate payment is made, it should clear against the accrued items. It does not. This might be due to missing account assign

  • Enqueued messages with Tuxedo /Q and WTC

    Hi everyone, I have a Tuxedo /Q that through a WTC puts messages in a JMS queue in a Weblogic. During a period with heavy load ( +- 200 messages per second), the total messages in the destination queue starts to increase, deprecating the application