Regarding generating levels in the parent-child relationship--- using BODS

Hi Experts,
I got a problem in generating the level for the child attribute at which it stands in the hierarchy. I have 2 columns in my input file one for parent_no and other for child_no. I need to generate the level of the child_no in the total hierarchy structure. I used vertical hierarchical_flattening but it is not generating the requied output, it is generating the tree structure for each and every node in the hierarchy.
What I need is my output file must contain the same number of rows as the input file and it must have an added column to it showing the level the child_no is in the hierarchy.
Kindly, give me some suggessions for aquiring the same.
Thanks in advance.
Edited by: Sudheer_157 on Jul 20, 2009 9:21 AM

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.

Similar Messages

  • How to output the outline parent-child relationship using a report script?

    I'd like to extract the outline's dimension members with it's parent-child relationship using a report script. Anybody can provide a sample script? Thanks.
    Example:
    DimensionX
    -----MemberX
    ----------ChildX
    Output:
    Dimension X MemberX
    MemberX ChildX
    Edited by: obelisk on Jan 11, 2010 5:16 PM

    Sorry a report script won't do it. You have two options
    1. Use at Essbase Outline API to walk the outline and get it for you
    2. Use the Outline extractor available from Applied Olap (it is a free download). It can be run interactively of as a bat file.
    Frankly, I would rather use 2 since I don't have to code it myself

  • 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.

  • How to Get the Parent - Child Relationship

    Hi ,
    In my application having 100 tables with parent - child releation ship without using casecade constraints
    i want to delete the parent with child and sub child records
    Example
    Table - 1
    parent1
    child 2
    Table - 2
    Child 1 - Parent 1
    Parent 2
    Table - 3
    Child 1 - Parent 2
    Parent 3
    Table - 4
    Child 1 - Parent 3
    How to delete the parent table ? Is it any scripts available ?
    Regards
    Sudhakar P.

    Hi,
    1) Firstly identify the parent tables using
    SELECT a.table_name, 0
    FROM user_tables a, user_tab_columns b
    WHERE a.table_name = b.table_name
    store these in one table say ID_table
    2) Identify dependent tables and sore in table say table_dependency using
    SELECT LEVEL, parenttable, parentcol, childtable, childcol
    FROM (SELECT UNIQUE parenttable, parentcol, childtable,
    b.column_name childcol
    FROM (SELECT p.table_name parenttable,
    k.column_name parentcol,
    k.POSITION pos,
    c.table_name childtable,
    c.constraint_name CONSTRAINT
    FROM all_constraints p,
    all_constraints c,
    all_cons_columns k
    WHERE p.constraint_name =
    c.r_constraint_name
    AND c.r_constraint_name =
    k.constraint_name
    AND p.constraint_type IN ('P', 'U')
    AND c.constraint_type = 'R'
    AND p.table_name != c.table_name
    ORDER BY p.table_name,
    c.constraint_name,
    k.POSITION) a,
    all_cons_columns b
    WHERE a.CONSTRAINT = b.constraint_name
    AND a.pos = b.POSITION)     
    3)Now using these details find tables without cascade rule as below
    SELECT *
    FROM table_dependency
    WHERE child_table IN (
    SELECT DISTINCT table_name
    FROM user_constraints
    WHERE constraint_type = 'R'
    AND delete_rule <> 'CASCADE'
    AND table_name IN (SELECT child_table
    FROM table_dependency)
    AND r_constraint_name IN (
    SELECT constraint_name
    FROM user_constraints
    WHERE table_name IN (
    SELECT table_name
    FROM id_table
    UNION
    SELECT child_table
    FROM table_dependency))
    AND table_name NOT IN (
    SELECT table_name
    FROM id_table));

  • How to achieve parent-child relationship using self join?

    my table structure is as follows
    parent child name
    -1     1     A1
    1     2     A2
    1     3     A3
    how to achieve the hierarchy model using self join. this can be easily achieved using "connect by prior". but how to achieve the same using self join?

    Hi,
    Yes, that's definitely possible. If you only need to display two levels from the hierarchy, a self-join is a good option. Make it an outer join if you need to show everyone on one level, regardless of whether they have a match on the other level or not; for example, if you want the output:
    child_name     child_id     parent_name     parent_id
    A1          1
    A2          2          A1          1
    A3          3          A1          1It's good that you posted some sample data. Now post the results you want from that data, and your query (what you think is the best attempt you've made so far). If you haven't tried anything so far, then look at some other simple self-join to get ideas.

  • Fetching parent-child relationship using API or XSD parsing?

    Hi,
    I would like to fetch all children of a parent object. I did not see any API to provide this information. I tried with GetMapping API, however it does not provide list of all child objects.
    E.g. Fetching all child of "Account" object should return all child objects {Activity, Address, Asset, Attachment, Business Plan, Claim, Deal Registration, Financial Account, Financial Account Holder, Financial Plan, Lead, Message Response, Note, Objective, Opportunity, Policy, Policy Holder, Revenue, Service Request, Special Pricing Request}
    Is it possible through API? If not, then XSD parsing seems to be the only way to retrieve children. Any guideline or rule on XSD parsing to get list of all children. XSD parsing doesn't look a good solution. Any other way to do so?
    This information is crucial for us. Please provide input.
    Thanks
    Ravish

    833189 wrote:
    Hi,
    I would like to fetch all children of a parent object. I did not see any API to provide this information. I tried with GetMapping API, however it does not provide list of all child objects.
    E.g. Fetching all child of "Account" object should return all child objects {Activity, Address, Asset, Attachment, Business Plan, Claim, Deal Registration, Financial Account, Financial Account Holder, Financial Plan, Lead, Message Response, Note, Objective, Opportunity, Policy, Policy Holder, Revenue, Service Request, Special Pricing Request}
    Is it possible through API? If not, then XSD parsing seems to be the only way to retrieve children. Any guideline or rule on XSD parsing to get list of all children. XSD parsing doesn't look a good solution. Any other way to do so?
    This information is crucial for us. Please provide input.
    Thanks
    RavishHi Ravish,
    Any success on this one? We are hurdling the same difficulty as of the moment. We are basically building a plugin that will remotely (and automatically) import a CRMOD object's data model. That goes to say also that we're relying on CRMOD's web services for our solution.
    I've read from the Web Services on Demand Guide that GetMapping is suppose to "Return the display names and XML tags of the fields of a record type *or one of its child components*..."+. It seems that this translates to - if you want the list of fields for a child component, you have to run GetMapping on the child component. If this is the case, what other available web services calls can we make to get the relationship hierarchy of a CRMOD object? Any help would be greatly appreciated.:-)
    Thank you,
    John

  • Import of parent/child relationships

    Hi,
    While importing the parent/child relationship using Import Manager,i selected the Relationship in the Destination table.After mapping the corresponding fields,alll the fields under Match Records tab are greyed out.How do i import the parent/child relationships?
    Thanks and Regards,
    Preethi

    Hi Preethi,
    Check the configuration options related to Relationships. In addition check the below link
    http://help.sap.com/saphelp_mdm550/helpdata/en/43/12036df94c3e92e10000000a1553f6/frameset.htm
    Importing Parent/Child Relationship Links
    Regards,
    Jitesh Talreja
    Edited by: Jitesh Talreja on May 5, 2009 4:17 PM

  • Custom IDoc Type missing segment parent/child relationships

    Hi.
    I copied the standard ORDERS05 IDoc type to a custom type and cut out quite a few segments.  My new IDoc type is setup with parent/child segment relationships, similar to many of the original relationships in ORDERS05. 
    When I use the standard FM IDOC_OUTPUT_ORDRSP to generate an IDoc, it's not creating with parent/child segment relationships.  It's placing the children at the same level as the parent. 
    Anyone know what I'm doing wrong?
    Thanks!
    Cal

    figured out the problem.  was missing a required segment used to establish the parent/child relationship.

  • 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

  • Re: Circular Parent-Child relationship amongwidgets.

    Alaiah,
    Setting the parent to NIL is the proper thing to do to remove
    a widget from a panel. Why don't you try just setting it
    to NIL and not adding the new chart to the window to make
    sure that it gets removed. If that doesn't work, maybe
    Window.UpdateDisplay, but you shouldn't have to do that.
    As far as the parent-child relationship issue, when you set
    the widget's Parent to NIL, that is actually invoking a virtual
    attribute that does more than just NIL out the reference. One
    of the things that happens is that the child is removed from
    the parent's Children array. Do a task.lgr.putline(<parent>.Children.Items)
    to see how many items are in the array, then do the NIL, then
    do a second putline and you'll see the array has one less item.
    Bobby
    At 06:10 PM 12/19/96 PST, Chandrashekar, Alaiah wrote:
    >
    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;

    Alaiah,
    Setting the parent to NIL is the proper thing to do to remove
    a widget from a panel. Why don't you try just setting it
    to NIL and not adding the new chart to the window to make
    sure that it gets removed. If that doesn't work, maybe
    Window.UpdateDisplay, but you shouldn't have to do that.
    As far as the parent-child relationship issue, when you set
    the widget's Parent to NIL, that is actually invoking a virtual
    attribute that does more than just NIL out the reference. One
    of the things that happens is that the child is removed from
    the parent's Children array. Do a task.lgr.putline(<parent>.Children.Items)
    to see how many items are in the array, then do the NIL, then
    do a second putline and you'll see the array has one less item.
    Bobby
    At 06:10 PM 12/19/96 PST, Chandrashekar, Alaiah wrote:
    >
    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;

  • Work Order and parent/child relationship

    I have been looking into the vision instance. There is an Asset-Rebuildable relationship, that is Forklif and it's battery. If there is a work order on the forklik "replace battery" can this be done automatically, or is this all manual.
    1. When I pick the new battery from stores the S/N of the battery is associated with the forklif (automatic I tested this)
    2. When I say "remove the old battery" should't the old battery parent/child relationship between the parent be broken and a child work order "charge" for the battery be logged. I could not reproduce that, but queried that this is what happens in vision. Are all these supposed to be manual?
    Regards

    From this plan, we can't easily get the parent child relationship like autotrace. Is there a way to get like autotrace?
    SELECT * FROM table(DBMS_XPLAN.DISPLAY);
    Plan hash value: 3693697345
    | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time | TQ |INOUT |PQ Distrib |
    | 0 | SELECT STATEMENT | | 1 | 117 | 6 (50) | 00:00:01 | | | |
    | 1 | PX COORDINATOR | | | | | | | | |
    | 2 | PX SEND QC (ORDER) |:TQ10003 | 1 | 117 | 6 (50) | 00:00:01 | Q1,03 | P->S | QC (ORDER) |
    | 3 | SORT ORDER BY | | 1 | 117 | 6 (50) | 00:00:01 | Q1,03 | PCWP | |
    | 4 | PX RECEIVE | | 1 | 117 | 5 (40) | 00:00:01 | Q1,03 | PCWP | |
    | 5 | PX SEND RANGE |:TQ10002 | 1 | 117 | 5 (40) | 00:00:01 | Q1,02 | P->P | RANGE |
    |* 6 | HASH JOIN | | 1 | 117 | 5 (40) | 00:00:01 | Q1,02 | PCWP | |
    | 7 | PX RECEIVE | | 1 | 87 | 2 (50) | 00:00:01 | Q1,02 | PCWP | |
    | 8 | PX SEND HASH |:TQ10001 | 1 | 87 | 2 (50) | 00:00:01 | Q1,01 | P->P | HASH |
    | 9 | PX BLOCK ITERATOR | | 1 | 87 | 2 (50) | 00:00:01 | Q1,01 | PCWC | |
    |* 10| TABLE ACCESS FULL | EMP | 1 | 87 | 2 (50) | 00:00:01 | Q1,01 | PCWP | |
    | 11 | BUFFER SORT | | | | | | Q1,02 | PCWC | |
    | 12 | PX RECEIVE | | 4 | 120 | 3 (34) | 00:00:01 | Q1,02 | PCWP | |
    | 13 | PX SEND HASH |:TQ10000 | 4 | 120 | 3 (34) | 00:00:01 | | S->P | HASH |
    | 14 | TABLE ACCESS FULL | DEPT | 4 | 120 | 3 (34) | 00:00:01 | | | |
    Predicate Information (identified by operation id):
    6 - access("E"."DEPTNO"="D"."DEPTNO")
    10 - filter("E"."ENAME"='hermann')
    ---------------------------------------------------

  • SHOW THE PARENT CHILD TABLE RELATIONSHIP TABLE

    hi experts,
    I want show the parent child relation ship tables
    for exmple iam passing the emp table then display related child tables like dept,grade after that again child table(dept,grade) related to child relationship tables like recursive
    Regards,
    VENKAT

    Probably something like below. This may not be exactly what you are looking for, but one way to get what you are asking for.
    Only if you can give specifics, of your Input being passed and the Output, it might be possible to provide more help. But you also need to help us with your best effort on this.
    select *
      from (
            select prior table_name Child, table_name Parent
              from user_constraints
             start with constraint_name = some_constraint_name_of_Parent_Table
            connect by constraint_name = prior r_constraint_name
           ) a
    where a.child is not null;

  • 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.

  • 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!

  • 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

Maybe you are looking for

  • Getting question marks instead of images on some pages

    any help would be greatly appreciated. when opening some pages i get blue box with white question mark in it. i have been through a complete erase and install. have installed all updates. when it tells me there is an error, i go to window/activity an

  • Mobile Account: Home Sync over VPN

    Hi, We 're now setting-up our mobile accounts to be used with laptops across several locations. Our servers will soon be moved to a datacenter. Before we do this, we're testing different functionalities. For instance there is a requirement to sync iO

  • SUBMIT statement for MD03 not working (module pool)

    I am trying to use SUBMIT stament for transaction MD03. SUBMIT SAPMM61X USING SELECTION-SETS OF PROGRAM '200' WITH matnr = matnr WITH werks = werks WITH versl = versl WITH baner = baner WITH lifkz = lifkz WITH diser = diser WITH plmod = plmod WITH tr

  • Drag and Drop Swing Components between two different Application Windows

    Hi!!! I tried the Dnd feature using the DnD api. It was a simple test, where I ahd two different app windows each made up of a JLabel. One I registered as drag component and the other as a drop component. the drop componenet(JLabel) does not have any

  • How do i delete files in my trash that will not delete

    I am having trouble deleting files in my trash that will not delete. I tried unlocking locked files but it will not let me unlock them while they are in trash. I also can not pull them back out of trash to unlock. They remain stuck in trash. Please h