Self referencing tree flavoured with another table

hello community,
sorry for stupid thread title, but I can't find the right description for what I want to do atm :)
I'm trying to create a tree from a self referencing table, but in addition I have to display childs with data from an aditional table (with reference to self referencing table). I'm using the latest JDeveloper (11.1.1.2.0) with internal WebLogic.
To create a "not so fictive" scenario: HR.EMPLOYEES + (new) table PROJECTS (project_id, employee_id, project_name) - I want to create a tree of all employees starting with King and in addition display the assigned projects for each employee.
It works fine without the PROJECTS table - self referencing just works as intended:
I did this by creating a "root" viewobject on EmployeesEO ("where EmployeesEO.MANAGER_ID is null"), one "standard" viewobject on EmployeesEO (EmployeesEOView) and one viewlink on EmployeesEOView linking to itself (0..1:* EmployeeId - ManagerId):
some screenshots:
[the datamodel|http://img405.imageshack.us/img405/9931/selfrefworksdatamodel.png]
[the binding rules|http://img525.imageshack.us/img525/6606/selfrefworksbinding.png]
[the browser output|http://img6.imageshack.us/img6/2906/selfrefworksbrowser.png]
Next, I created another (standard) viewobject on my (new) table "projects" and then created a new viewlink on EmployeesEOView (source) linking to my new AspProjectsEOView (destination) with cardinality 0..1:* EmployeeId - EmployeeId.
After this, I added the new created viewlink to the data model of the application module and bound the new data control to the page again (as best as I could figure out the bindings).
The result is kinda strange, I guess because ADF wants (but can't) figure out wich one to display. Well it should not display one of them, but both.
again, some screenshots:
[the datamodel|http://img297.imageshack.us/img297/6721/selfrefnotokdatamodel.png]
[the binding rules|http://img263.imageshack.us/img263/6820/selfrefnotokbinding.png]
[the browser output|http://img263.imageshack.us/img263/1720/selfrefnotokbrowser.png]
Well you may ask yourself what's my desired result: All stays the same (in this example) but the last "manager" looks like this (in expanded mode)
201 Michael Hartstein 100
____> 202 Pat Fray 201
____> Project 1
Any employee without projects should appear in the usual way (not to be filtered out), the projects should just be added.
My question is: is this even possible? If yes, how? If not, is there a way to "adjust" the output text of the "subviews" (this could be a "low tech" version - subelements named "Employees" and "Projects" instead of "EmployeesEOView" and "AspProjectsEOView")
Thanks alot in advance for any hint!
Edited by: asp_jko on 18.12.2009 17:46

any help? please! :)

Similar Messages

  • WD ABAP: Recursion Nodes that Repeat Tree Nodes with Embedded Tables ???

    At Rich H's suggestion, I'm posting this here as well as in the blogs.
    Suppose you've got a tree context with a node that has a table embedded under it. (For example, the TREE_WITH_TABLE view of WDR_TEST_EVNT has this kind of context substructure.) Call this node "NODE_WITH_TABLE."
    You now define a recursion node underneath "NODE_WITH_TABLE" and specify "NODE_WITH_TABLE" as the repeated node for this recursion node. Call this recurion node "RECURSION_NODE".
    Lo and behold - the table fills properly when you're on any instance of "NODE_WITH_TABLE", but not when you're on an instance of "RECURSION_NODE".
    I'm hoping that:
    a) I'm doing something wrong;
    OR
    b) There's an easy work-around/alternative I'm not seeing
    OR
    c) SAP will give recursion nodes enough memory to carry any table(s) embedded in the nodes they're repeating.
    'Cause I sure don't want to have to define "n" levels of tree-nodes that have different copies of the same table(s) embedded in them.
    Message was edited by: Armin Reichert

    /people/david.halitsky/blog/2006/08/16/recursion-nodes-that-repeat-tree-nodes-with-embedded-tables-in-wd-abap-not
    Maybe you might want to back out your weblog as it is not really a place to ask these types of questions.  Think of it this way,  if you are allowed to do this type of weblog,  what is stopping any other weblogger.  Hence the weblogs would just be another forum, which I don't think anyone wants. 
    Regards,
    Rich Heilman

  • Flex 4, is it possible to populate a tree component with sqlite table data?

    is it possible to populate a tree component with sqlite table data?
    If it is, how would I go about doing this?
    Thanks
    Kristin

    Hi Mustafa,
    it is true, the function can return component as type. This is more for the scenario, when you want to recognize some component based on some checks, eg.
    if(something)
    return CHECKBOX_1;
    else
    return CHECKBOX_2;
    so, the use case exists for sure. But of course the application itself is static.
    where do you see a scenario for dynamic creation of components?
    The only one component which can instantiate new components is the SplitCellContainer, and this is restricted to the drag&drop action from Fragment Bookmark Gallery. And this is again restricted to containers, as Fragment can hold containers as parent component. Of course the container content will be created/instantiated as well (I have coded example with ComponentManager in the Community SDK: Second Functional Application with SDK Components (Online Composition v.2) blog).
    As far I know there is no function in SplitCellContainer which would "simulate" the drop of a Fragment today (perhaps worth an Idea on this?). Having that - the scenario would be possible. Today, this can be made partly - but the user would need to drag&drop a prepared fragment with the component.
    Anyway, the problems will start after the creation - then it would be require to have also functions to re-position the new created component in some other container - this would be complex probably.
    Karol

  • Copy the structure of a table to another with another table name.

    how to copy the structure of a table to another with another table name.
    ie. i want a emp table with same values/structure to be copied to another table called my_employee.
    how can this be done?

    create table my_emp as select * from emp;
    If you do not want the data to be copied then do the following:
    create table my_emp as select * from emp
    where 1=2;
    Avanti.

  • How to union mulitple itemset column with another  tables

    Hi ,
    i have the following table called itemset as below ,
    A
    ;1;10;2;3;4;5;7;8
    ;10;2;3;4;5;8;9
    ;10;2;3;4;8;9
    and another table called temp as below ,
    B
    1
    2
    6
    and need to find the union of those 2 tables as below ,
    A---------------------| B--| A Union B
    ;1;10;2;3;4;5;7;8 | 1 |;1;10;2;3;4;5;7;8
    ;1;10;2;3;4;5;7;8 | 2 |;1;10;2;3;4;5;7;8
    ;1;10;2;3;4;5;7;8 | 6 |;1;10;2;3;4;5;7;8;6
    ;10;2;3;4;5;8;9 |1 |;10;2;3;4;5;8;9;1
    ;10;2;3;4;5;8;9 |2 |;10;2;3;4;5;8;9
    ;10;2;3;4;5;8;9 |6 |;10;2;3;4;5;8;9;6
    ;10;2;3;4;8;9 |1 |;10;2;3;4;8;9;1
    ;10;2;3;4;8;9 |2 |;10;2;3;4;8;9
    ;10;2;3;4;8;9 |6 |;10;2;3;4;8;9;6
    any help please ,
    Edited by: user11309581 on Jun 26, 2011 10:43 PM
    Edited by: user11309581 on Jun 26, 2011 10:47 PM

    with a as (
               select ';1;10;2;3;4;5;7;8' str from dual union all
               select ';10;2;3;4;5;8;9' from dual union all
               select ';10;2;3;4;8;9' from dual
         b as (
               select '1' str from dual union all
               select '2' from dual union all
               select '6' from dual
    -- end of on-the-fly data sample
    select  a.str,
            b.str,
            case
              when a.str || ';' like '%;' || b.str || ';%' then a.str
              else a.str || ';' || b.str
            end combined_str
      from  a,
            b
    STR               S COMBINED_STR
    ;1;10;2;3;4;5;7;8 1 ;1;10;2;3;4;5;7;8
    ;1;10;2;3;4;5;7;8 2 ;1;10;2;3;4;5;7;8
    ;1;10;2;3;4;5;7;8 6 ;1;10;2;3;4;5;7;8;6
    ;10;2;3;4;5;8;9   1 ;10;2;3;4;5;8;9;1
    ;10;2;3;4;5;8;9   2 ;10;2;3;4;5;8;9
    ;10;2;3;4;5;8;9   6 ;10;2;3;4;5;8;9;6
    ;10;2;3;4;8;9     1 ;10;2;3;4;8;9;1
    ;10;2;3;4;8;9     2 ;10;2;3;4;8;9
    ;10;2;3;4;8;9     6 ;10;2;3;4;8;9;6
    9 rows selected.
    SQL>  SY.

  • Join with another table in pre-query

    Hi,
    We have a large data block and we need to order some columns based on street name for example, not id. The base table of db block contains an id_street column, and 'streets' table contains id and name.
    Ok, in pre-query trigger of that block, we have a complex logic and we dynamically build the where clause. At the end, we set the order_By clause of the block, to order the rows, for example we need to order by the 'my_date' column asc (it's a date type column), and street desc; but street NAME, not id. We don't want to use a from clause query, because the dynamically where clause logic it's complex.
    How can we join the db block table with 'streets' table in pre-query, so when constructing the order by clause to specify something like
    set_block_property('ADRESE_NEZONATE', order_by, 'my_date, name desc');where 'name' is the name of the street, from the 'streets' table.
    Is it possible in pre-query, somehow? Or, in my case where can I join with that table and use that column in pre-query at setting order by?
    Thanks!
    Edited by: Roger25 on 26.04.2013 12:31

    I understand what you say but partially.. please explain in more detail how to do that;
    How should look the adrese_nezonate block, then? I have to add a 'name' column and set copy value from item property to 'STREETS.NAME', and database_property No?
    Then the post-query trigger how should look like (the order by clause)? The post-query sends the entire query (with where/order by clauses) to the server, but in that "select... where... order by" (built dynamically) there are only columns from that block (adrese_nezonate). I need to join with streets, INSIDE that query.
    Thanks.

  • How to improve the updating a sql server table with another table in Oracle

    Hi there.
    I am trying to do the next updating in SSIS
    UPDATE S
    SET
    S.COLUMN_A = OT.COLUMN_A,
    S.COLUMN_B = OT.COLUMN_B
    FROM 
    SQLT1 S INNER JOIN ORACLET1  OT ON
    S. COLUMN_C = OT.COLUMN_C
    This is what I am doing:
    I am taking the Oracle data with the ODBC Source like this.
    Select column_A, column_B, column_C
    from OracleT1
    The thing is, the Oracle table has millions of registers and this updating is taking a lot. But I am not sure if it is maybe because of the design of the update query.
    I wonder is if there is another way to design this query or improve the performance of this task.
    Thanks a lot.

    Yes
    Use a OLEDB destination instead and save the records to a staging table
    Then use a subsequent Execute sql task and do the set based update in it as below
    UPDATE t
    SET COLUMN_A = s.COLUMN_A,
    COLUMN_B = s.COLUMN_B
    FROM SQLT1 t
    INNER JOIN stagingTable s
    ON s.COLUMN_C = t.COLUMN_C
    This would be much faster as its set based
    Please Mark This As Answer if it solved your issue
    Please Vote This As Helpful if it helps to solve your issue
    Visakh
    My Wiki User Page
    My MSDN Page
    My Personal Blog
    My Facebook Page

  • Update Problem - Join With Another Table

    I'm trying to convert few MS Access Queries into Oracle. Following is one of the query from MS Access.
    <font face="courier">
    UPDATE [RESULT] INNER JOIN [MASTER]
        ON ([RESULT].[LAST_NAME] = [MASTER].[LAST_NAME])
       AND ([RESULT].[FIRST_NAME] = [MASTER].[FIRST_NAME])
       AND ([RESULT].[DOCUMENT_NUMBER] = [MASTER].[DOCUMENT_NUMBER])
       AND ([RESULT].[BATCH_ID] = [MASTER].[LEAD_ID])
    SET [MASTER].[CLOSURE_REASON] = "Closed For Name and Document Number Match",
        [MASTER].[RESULT_ID] = [RESULT].[ID],
        [MASTER].[RESULT_PID] = [RESULT].[PID]
    WHERE (([MASTER].[CLOSURE_REASON] Is Null)
       AND ([MASTER].[REC_CODE] = "A1")
       AND ([RESULT].[EVENT_DATE] = [MASTER].[EVENT_DATE])
       AND ([RESULT].[EVENT_TYPE] = "Open")
       AND ([MASTER].[DOCUMENT_NUMBER] Is Not Null)
       AND ([MASTER].[DOCUMENT_NUMBER)] "null"));
    </font>
    First I received ORA-01779: cannot modify a column which maps to a non key-preserved table Error. I followed different examples (including MERGE) from your
    site and modified my original query. Now, I receive ORA-30926: unable to get a stable set of rows in the source tables Error.
    Most of the examples showed only one join between the tables but I have to make more joins based on my requirements.
    Any help translating this query in to Oracle would be Great. Thanks!

    Assuming that the columns you are joining to in the result table are the whole PK or are declared as aunique contraint (i.e. some combination of last_name, first_name, document_number, batch_id, event_date, id, and pid make up the entire PK/unique constraint), then the updateable join view should look something like:
    update (select m.last_name, m.first_name, m.document_number, m.lead_id,
                   m.closure_reason, m.result_id, r.id, m.result_pid, r.pid
            from master m
               join result r
                  on r.last_name = m.last_name and
                     r.first_name = m.first_name and
                     r.document_number = m.document_number and
                     r.batch_id = m.lead_id and
                     r.event_date = m.event_date
            where m.closure_reason is null and
                  m.rec_code = 'A1' and
                  r.event_type = 'Open' and
                  m.document_number is not null and
                  m.document_number != 'null')
    set closure_reason = 'Closed For Name and Document Number Match',
        result_id = id,
        result_pid = pidThe merge version would look something like:
    merge into master
       using (select last_name, first_name, document_number, batch_id,
                     event_date, id, pid
              from result
              where event_type = 'Open') r
       on (r.last_name = m.last_name and
           r.first_name = m.first_name and
           r.document_number = m.document_number and
           r.batch_id = m.lead_id and
           r.event_date = m.event_date)
       when mathed then
          update
          set closure_reason = 'Closed For Name and Document Number Match',
              result_id = id,
              result_pid = pid
          where m.closure_reason is null and
                m.rec_code = 'A1' and
                m.document_number is not null and
                m.document_number != 'null';However, as Hoek pointed out, the combination of last_name, first_name, document_number, batch_id, event_date, id, and pid must point to a unique row in the result table, whether they make up the PK or a unique constraint. If there are, or could be, multiple rows for a particular combination of last_name, first_name, document_number, batch_id, event_date, id, and pid, then you will need to find a way to determine which of those rows should be used to do the update.
    John

  • Need some help with the Table Function Operator

    I'm on OWB 10gR2 for Sun/Solaris 10 going against some 10gR2 DB's...
    I've been searching up and down trying to figure out how to make OWB use a Table Function (TF) which will JOIN with another table; allowing a column of the joined table to be a parameter in to the TF. I can't seem to get it to work. I'm able to get this to work in regular SQL, though. Here's the setup:
    -- Source Table:
    DROP TABLE "ZZZ_ROOM_MASTER_EX";
    CREATE TABLE "ZZZ_ROOM_MASTER_EX"
    ( "ID" NUMBER(8,0),
    "ROOM_NUMBER" VARCHAR2(200),
    "FEATURES" VARCHAR2(4000)
    -- Example Data:
    Insert into ZZZ_ROOM_MASTER_EX (ID,ROOM_NUMBER,FEATURES) values (1,'Room 1',null);
    Insert into ZZZ_ROOM_MASTER_EX (ID,ROOM_NUMBER,FEATURES) values (2,'Room 2',null);
    Insert into ZZZ_ROOM_MASTER_EX (ID,ROOM_NUMBER,FEATURES) values (3,'Room 3','1,1;2,3;');
    Insert into ZZZ_ROOM_MASTER_EX (ID,ROOM_NUMBER,FEATURES) values (4,'Room 4','5,2;5,4;');
    Insert into ZZZ_ROOM_MASTER_EX (ID,ROOM_NUMBER,FEATURES) values (5,'Room 5',' ');
    -- Destination Table:
    DROP TABLE "ZZZ_ROOM_FEATURES_EX";
    CREATE TABLE "ZZZ_ROOM_FEATURES_EX"
    ( "ROOM_NUMBER" VARCHAR2(200),
    "FEATUREID" NUMBER(8,0),
    "QUANTITY" NUMBER(8,0)
    -- Types for output table:
    CREATE OR REPLACE TYPE FK_Row_EX AS OBJECT
    ID NUMBER(8,0),
    QUANTITY NUMBER(8,0)
    CREATE OR REPLACE TYPE FK_Table_EX AS TABLE OF FK_Row_EX;
    -- Package Dec:
    CREATE OR REPLACE
    PACKAGE ZZZ_SANDBOX_EX IS
    FUNCTION UNFK(inputString VARCHAR2) RETURN FK_Table_EX;
    END ZZZ_SANDBOX_EX;
    -- Package Body:
    CREATE OR REPLACE
    PACKAGE BODY ZZZ_SANDBOX_EX IS
    FUNCTION UNFK(inputString VARCHAR2) RETURN FK_Table_EX
    AS
    RETURN_VALUE FK_Table_EX := FK_Table_EX();
    i NUMBER(8,0) := 0;
    BEGIN
    -- TODO: Put some real code in here that will actually read the
    -- input string, parse it out, and put data in to RETURN_VALUE
    WHILE(i < 3) LOOP
    RETURN_VALUE.EXTEND;
    RETURN_VALUE(RETURN_VALUE.LAST) := FK_Row_EX(4, 5);
    i := i + 1;
    END LOOP;
    RETURN RETURN_VALUE;
    END UNFK;
    END ZZZ_SANDBOX_EX;
    I've got a source system built by lazy DBA's and app developers who decided to store foreign keys for many-to-many relationships as delimited structures in driving tables. I need to build a generic table function to parse this data and return it as an actual table. In my example code, I don't actually have the parsing part written yet (I need to see how many different formats the source system uses first) so I just threw in some stub code to generate a few rows of 4's and 5's to return.
    I can get the data from my source table to my destination table using the following SQL statement:
    -- from source table joined with table function
    INSERT INTO ZZZ_ROOM_FEATURES_EX(
    ROOM_NUMBER,
    FEATUREID,
    QUANTITY)
    SELECT
    ZZZ_ROOM_MASTER_EX.ROOM_NUMBER,
    UNFK.ID,
    UNFK.QUANTITY
    FROM
    ZZZ_ROOM_MASTER_EX,
    TABLE(ZZZ_SANDBOX_EX.UNFK(ZZZ_ROOM_MASTER_EX.FEATURES)) UNFK
    Now, the big question is--how do I do this from OWB? I've tried several different variations of my function and settings in OWB to see if I can build a single SELECT statement which joins a regular table with a table function--but none of them seem to work, I end up getting SQL generated that won't compile because it doesn't see the source table right:
    INSERT
    /*+ APPEND PARALLEL("ZZZ_ROOM_FEATURES_EX") */
    INTO
    "ZZZ_ROOM_FEATURES_EX"
    ("ROOM_NUMBER",
    "FEATUREID",
    "QUANTITY")
    (SELECT
    "ZZZ_ROOM_MASTER_EX"."ROOM_NUMBER" "ROOM_NUMBER",
    "INGRP2"."ID" "ID_1",
    "INGRP2"."QUANTITY" "QUANTITY"
    FROM
    (SELECT
    "UNFK"."ID" "ID",
    "UNFK"."QUANTITY" "QUANTITY"
    FROM
    TABLE ( "ZZZ_SANDBOX_EX"."UNFK2" ("ZZZ_ROOM_MASTER_EX"."FEATURES")) "UNFK") "INGRP2",
    "ZZZ_ROOM_MASTER_EX" "ZZZ_ROOM_MASTER_EX"
    As you can see, it's trying to create a sub-query in the FROM clause--causing it to just ask for "ZZZ_ROOM_MASTER_EX"."FEATURES" as an input--which isn't available because it's outside of the sub-query!
    Is this some kind of bug with the code generator or am I doing something seriously wrong here? Any help will be greatly appreciated!

    Hello Everybody!
    Thank you for all your response!
    I had changes this work area into Internal table and changed the select query. PLease let me know if this causes any performance issues?
    I had created a Z table with the following fields :
    ZADS :
    MANDT
    VKORG
    ABGRU.
    I had written a select query as below :
    I had removed the select single and insted of using the Structure it_rej, I had changed it into Internal table 
    select vkorg abgru from ZADS into it_rej.
    Earlier :
    IT_REJ is a Work area:
    DATA : BEGIN OF IT_REJ,
    VKORG TYPE VBAK-VKORG,
    ABGRU TYPE VBAP-ABGRU,
    END OF IT_REJ.
    Now :
    DATA : BEGIN OF IT_REJ occurs 0,
    VKORG TYPE VBAK-VKORG,
    ABGRU TYPE VBAP-ABGRU,
    END OF IT_REJ.
    I guess this will fix the issue correct?
    PLease suggest!
    Regards,
    Developer.

  • Nested tables won't allign with primary table

    Hello all. It looks like I’m faced with another
    table-related obstacle. While I was creating one of my inner pages,
    I’ve utilized nested tables to create a column on the left
    hand side of the page that will hold my secondary menu, while the
    other column will hold a flash element and page content.
    Although I’ve inserted all nested tables with
    “0” cell spacing and “0” cell padding, and
    the visual aids seem to suggest that the values of the nested table
    are identical with the primary table that holds them, the nested
    table that will hold the movie and page content isn’t flush
    with the table above. It seems to be off only by 1-2 pixels or so,
    but since there will be an image right underneath the menu this is
    quite obvious.
    I have attached the code for your information (line 165,
    166).
    Thank you for your time and suggestions. I really appreciate
    it.

    On Sat, 16 Sep 2006 15:06:50 +0000 (UTC), "HTML-Newbie"
    <[email protected]> wrote:
    > Check out the link
    http://www.fastventures.com/dev/test_temp_2col.html
    and you
    >will see that the picture underneath the main menu won't
    line up with it on the
    >right-hand side.
    Change this:
    <table width="572" border="0" cellspacing="0"
    cellpadding="0">
    <tr>
    <td height="200" valign="top"><img
    src="img/place_second.jpg" width="572"
    height="200"></td>
    </tr>
    To this:
    <table width="572" border="0" cellspacing="0"
    cellpadding="0"
    align="right">
    <tr>
    <td height="200" valign="top"><img
    src="img/place_second.jpg" width="572"
    height="200"></td>
    </tr>
    Gary

  • Synchronize form with self-referencing VO in tree table. POJO Based Model

    Hello. I need your help
    ADF Code Corner sample #32 show how to build a tree table from a self referencing VO:
    [http://www.oracle.com/technetwork/developer-tools/adf/learnmore/index-101235.html#CodeCornerSamples]
    ADF Code Corner document Oracle JDeveloper OTN Harvest 09/2011 by Frank Nimphius show how to build an edit form for the table data and how to synchronize it with the selected row in the tree table:
    [http://www.oracle.com/technetwork/developer-tools/adf/learnmore/sept2011-otn-harvest-508189.pdf]
    This examples are helpful, but i have a problem, i have not a model based on a database, my application datamodel is based in POJO objects, there are no appModules or ViewObjects so I do not know how to reference the tree table target attribute with the edit form iterator.
    Can anyone help me?
    Maybe (i dont know how) i need make a VO and a AppModule that wraps the POJO model ?
    thank you very much

    Hi,
    this should work the same. You create a tree from a POJO Data Control based on your POJO Model. Expose another collection pointing to the same data set and drag it as the form. Use the setting on the tree configuration dialog to set the current row in the tree as the current in the form iterator.
    Frank

  • How to build query to get tree architecture of self referencing table

    Dear all,
    I have the following table design :
    This is a self referencing table representing a set of SubCategories which can have parent sub categories or not. I did not show here the Category table.
    If the Subcategory has the ParentSubCategory ID = null, then this is a root subcategory otherwise it is a child of a parent sub category.
    What I am looking for is the easy way to display the structure level by ProductCategoryID ?
    Thanks for helps

    you can use a recursive logic based on CTE for that
    something like this would be enough
    ;WITH ProdSubCat_Hiererchy
    AS
    SELECT psc.ProductSubCategoryID,c.CategoryName,psc.ParentSubCategoryID, psc.Name,CAST(psc.Name AS varchar(max)) AS [Path],1 AS [level]
    FROM ProductSubCategory psc
    INNER JOIN Category c
    ON c.CategoryID = psc.ProductCategoryID
    WHERE psc.ParentSubCategoryID IS NULL
    UNION ALL
    SELECT psc.ProductSubCategoryID,c.CategoryName,psc.ParentSubCategoryID, psc.Name,CAST(psch.[Path] + '/' + psc.Name AS varchar(max)) AS [Path],psch.[level] + 1
    FROM ProductSubCategory psc
    INNER JOIN Category c
    ON c.CategoryID = psc.ProductCategoryID
    INNER JOIN ProdSubCat_Hiererchy psch
    ON psch.ProductSubCategoryID = psc.ParentSubCategoryID
    SELECT *
    FROM ProdSubCat_Hiererchy
    ORDER BY LEFT([Path],CHARINDEX('/',[Path]+'/')-1),[Level]
    OPTION (MAXRECURSION 0)
    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

  • Self Referencing Tables...

    I have a self-referencing table (a Topic can be a response to another Topic) and read one of Frank Nimphius' blogs on this subject, posted on the ADF board for advise. As a result I created the read-only ViewObject to set up this tree relationship and set it to be exposed to the App Module.
    Do I need to do more to it than that for JHeadstart to generate the right page defs? Any advise on setting this up cleanly? My user interface must present a page in which users can post new Topics, view topics in a heirarchy (response thread, like in this forum) and respond to Topics or responses. A response is a Topic that references another (parent) Topic. I have to believe this has been done before a million times but am not sure myself how to do it.
    Thanks!

    Steve,
    I've read the section and am getting this error:
    (oracle.jbo.SQLStmtException) JBO-27122: SQL error during statement preparation. Statement: SELECT Topic.SUBJECT, Topic.ROW_ID, Status.STATUS_CHOICE, Status.ROW_ID AS ROW_ID11, Topic.CREATED_BY, Topic.CREATION_DATE, Response.SUBJECT AS SUBJECT1, Response.CREATION_DATE AS CREATION_DATE1, Response.ROW_ID AS ROW_ID12, Response.CREATED_BY AS CREATED_BY1 FROM TOPIC Topic, RESPONSE Response, STATUS Status WHERE (Topic.ROW_ID = Response.MASTER_ID (+)) AND (Topic.TOPIC_STATUS_ID = Status.ROW_ID) CONNECT BY PRIOR Topic.ROW_ID = Response.MASTER_ID (+) OR Response.ROW_ID = Response.MASTER_ID (+) ORDER BY SUBJECT,CREATION_DATE1
    ----- LEVEL 1: DETAIL 0 -----
    (java.sql.SQLException) ORA-01436: CONNECT BY loop in user data
    I have a table called Topic with a Pk called ROW_ID and another table called Response with a Pk called ROW_ID and an Fk called MASTER_ID. A Topic can have many Responses and a Response can also have many Responses. The parent ID could point to either a Topic or a Response. There's no limit on how many levels this can continue. There's a Status table also from which I want to show the text value of the Status for the Topic row (not the Status ROW_ID)
    I have a View Object including entities: Topic, Response & Status
    I tried the SQL query as:
    (Topic.ROW_ID = Response.MASTER_ID (+)) AND (Topic.TOPIC_STATUS_ID = Status.ROW_ID) CONNECT BY PRIOR Topic.ROW_ID = Response.MASTER_ID (+) OR Response.ROW_ID = Response.MASTER_ID (+)
    Hoping to have this result:
    Topic A
    -Response A (to Topic A)
    --Response B (to A)
    ---Response C (to B)
    -Response D (to Topic A)
    Topic B
    Topic C
    What am I doing wrong?
    Is there a guide that explains better using JHeadstart with JDeveloper (rather than Oracle Designer, which we don't use)? The developer's guide for JHeadstart is hard to translate for use with JDeveloper...
    Thanks!!

  • Best practice: self referencing table

    Hallo,
    I want to load a self referencing table to my enterprise area in the dwh. I am not sure how to do this. What if a record references to another record which is inserted later in the same etl process? There is now way to sort, because it is possible that record a references to record b and record b references to record a. Disabling the fk constraint is not a good idea, because this doesn't prevent that invalid references will be loaded? I am thinking of building two mappings, one without the self referencing column and the other only with it, but that would cause approx. twice as much running time. Any other solutions?
    Regards,
    Torsten

    Mind sharing the solution? Would be interested to hear your solution (high level).
    Jean-Pierre

  • ORA-02291 during MERGE on self-referenced table

    Hello,
    I encountered error ORA-02291 when I tried to use MERGE statement on the table with "self-referenced" foreign key. Using the foreign key deferrable did not help. The only one thing, which helped me, was using errorlog table. See the demonstration:
    Working as common user:
    SQL> CONNECT scott/tiger
    First of all, I create table and (not deferrable) constraints:
    CREATE TABLE fkv (
         id NUMBER(1) CONSTRAINT nn_fkv_id NOT NULL,
         parent_id NUMBER(1) CONSTRAINT nn_fkv_paid NOT NULL
    ALTER TABLE fkv ADD CONSTRAINT pk_fkv_id PRIMARY KEY (id);
    ALTER TABLE fkv ADD CONSTRAINT fk_fkv_paid FOREIGN KEY (parent_id) REFERENCES fkv(ID) NOT DEFERRABLE;
    INSERT is working well:
    INSERT INTO fkv (
         id,
         parent_id
    SELECT
    1,
    1
    FROM
    DUAL;
    COMMIT;
    1 rows inserted.
    commited.
    MERGE statement using UPDATE branch is working well too:
    MERGE INTO fkv USING (
    SELECT
    1 AS ID,
    1 AS PARENT_ID
    FROM
    DUAL
    ) a
    ON (
    fkv.id = a.id
    WHEN MATCHED THEN
    UPDATE SET
    fkv.parent_id = a.parent_id
    WHERE
    A.ID IS NOT NULL
    DELETE WHERE a.id IS NULL
    WHEN NOT MATCHED THEN
    INSERT (
    ID,
    parent_id
    VALUES (
    A.ID,
    A.PARENT_ID);
    COMMIT;                                        
    1 rows merged.
    commited.
    And now is coming the strange behaviour:
    MERGE INTO fkv USING (
    SELECT
    2 AS id,
    2 AS PARENT_ID
    FROM
    DUAL
    ) a
    ON (
    fkv.id = a.id
    WHEN MATCHED THEN
    UPDATE SET
    fkv.parent_id = a.parent_id
    WHERE
    A.ID IS NOT NULL
    DELETE WHERE a.id IS NULL
    WHEN NOT MATCHED THEN
    INSERT (
    ID,
    parent_id
    VALUES (
    A.ID,
    A.PARENT_ID);
    SQL Error: ORA-02291: integrity constraint (SCOTT.FK_FKV_PAID) violated - parent key not found
    ROLLBACK;
    rollback complete.
    Ok, even it is not a good solution, I try deferrable constraint:
    ALTER TABLE fkv DROP CONSTRAINT fk_fkv_paid;
    ALTER TABLE fkv ADD CONSTRAINT fk_fkv_paid FOREIGN KEY (parent_id) REFERENCES fkv(id) DEFERRABLE INITIALLY DEFERRED;
    table FKV altered.
    table FKV altered.
    MERGE INTO fkv USING (
    SELECT
    2 AS id,
    2 AS PARENT_ID
    FROM
    DUAL
    ) a
    ON (
    fkv.id = a.id
    WHEN MATCHED THEN
    UPDATE SET
    fkv.parent_id = a.parent_id
    WHERE
    A.ID IS NOT NULL
    DELETE WHERE a.id IS NULL
    WHEN NOT MATCHED THEN
    INSERT (
    ID,
    parent_id
    VALUES (
    A.ID,
    A.PARENT_ID);
    1 rows merged.
    COMMIT;
    SQL Error: ORA-02091: transaction rolled back
    ORA-02291: integrity constraint (SCOTT.FK_FKV_PAID) violated - parent key not found
    ... deffered constraint did not help :-(
    Let's try another way - errorlog table; for the first with the not deferrable constraint again:
    ALTER TABLE fkv DROP CONSTRAINT fk_fkv_paid;
    ALTER TABLE fkv ADD CONSTRAINT fk_fkv_paid FOREIGN KEY (parent_id) REFERENCES fkv(ID) NOT DEFERRABLE;
    table FKV altered.
    table FKV altered.
    BEGIN
    sys.dbms_errlog.create_error_log (
    dml_table_name => 'FKV',
    err_log_table_name => 'ERR$_FKV'
    END;
    anonymous block completed
    Toys are prepared, let's start with error logging:
    MERGE INTO fkv USING (
    SELECT
    2 AS id,
    2 AS PARENT_ID
    FROM
    DUAL
    ) a
    ON (
    fkv.id = a.id
    WHEN MATCHED THEN
    UPDATE SET
    fkv.parent_id = a.parent_id
    WHERE
    A.ID IS NOT NULL
    DELETE WHERE a.id IS NULL
    WHEN NOT MATCHED THEN
    INSERT (
    ID,
    parent_id
    VALUES (
    A.ID,
    A.PARENT_ID)
    LOG ERRORS INTO err$_fkv;
    1 rows merged.
    Cannot belive, running SELECT for confirmation:
    SELECT * FROM err$_fkv;                    
    SELECT * FROM fkv;
    no rows selected
    ID PARENT_ID
    1 1
    2 2
    Ok, COMMIT:
    COMMIT;
    commited.
    SELECT for confirmation again:
    SELECT * FROM err$_fkv;                    
    SELECT * FROM fkv;
    no rows selected
    ID PARENT_ID
    1 1
    2 2
    Using deffered constraint and error logging is working well too.
    Metalink and Google did not help me. I am using databases 10.2.0.5 and 11.2.0.3.
    Has somebody encountered this problem too or have I missed something?
    Thank you
    D.

    drop table fkv;
    CREATE TABLE fkv (
    id NUMBER(1) CONSTRAINT nn_fkv_id NOT NULL,
    parent_id NUMBER(1) CONSTRAINT nn_fkv_paid NOT NULL
    CREATE INDEX PK_FKV_ID ON FKV(ID);
    ALTER TABLE fkv ADD CONSTRAINT pk_fkv_id PRIMARY KEY (id);
    ALTER TABLE FKV ADD CONSTRAINT FK_FKV_PAID FOREIGN KEY (PARENT_ID) REFERENCES FKV(ID);Now run your MERGE statement and it works with non deferrable constraints.
    Personally, I would contact support about this before depending on it in production.
    P.S. I was not able to reproduce your findings that dropping and re-adding the constraints changes things. I suspect that when you dropped the constraint the index was NOT dropped, so you kept a non-unique index.
    Try again using ALTER TABLE FKV DROP CONSTRAINT PK_FKV_ID drop index;

Maybe you are looking for

  • Background job getting CANCELLED

    hello, i have  a background job scheduled for a report program.it is getting cancelled and giving the following error: "TABLE_ILLEGAL_STATEMENT" You attempted to change, delete or create a line in the        internal table "???", but no valid cursor

  • How to integrate different database in SAP B1 into unique DB?

    Hello, In our landscape, we've SAP B1 System and we also build SAP BW on Hana reports using B1 as a source system. Currently, in SAP B1 system, we don't have unique database.  Rather, we have distinct database for different Sales Offices.  At present

  • Service module by S/N, best practice

    Hi all,<p> Can someone confirm this behavior in SBO (8.8), for providing service to customer based on serial numbered item, <p> 1. Customer equipment card (CEC) > this specific to serial numbered items only. Only one CEC can be produce for 1 specific

  • HT1386 After updating my iPad all my albums seam to have vanished ?how do I get them back

    I updated to iOS 7.1 on my iPad mini retainer ,when I went to see my music not all my albums were there all my Beatles albums had. Gone and johny cash ones too I did a backup but that doesn't seem to work either can any one help me ? 

  • Mac pro slow

    I have a mac pro (2008 early), all of a sudden it hangs and stalls to the point of me clicking on something and then waiting 30 seconds for it to respond? Recent changes (yes i did it all at once): added 8gb of RAM + installed new OSX Server. Here is