Child parent multi in an AppModuleDataControl

Hello

I am creating an application requiring several (5 +) level of relationship parent/child in an AppModuleDataControl...

(using the tutorial following as an example: http://docs.oracle.com/cd/E37547_01/tutorials/tut_rich_app/tut_rich_app_2.html)

Is this something that is possible?

Thanks in advance

User, please tell us your jdev version.

Yes, it is possible. Where do you see a problem? If your data mode has that kind of relationship you build (or if foreign keys are configured in the db you get automatically). a sample until lever 3: JDeveloper & amp; ADF: Several Tables cascading | JDev & amp; Goodies ADF

Timo

Tags: Java

Similar Questions

  • Perfected request based on child parents ask completion status FND_REQUEST. SUBMIT_REQUEST, sub_request TRUE

    Hi gurus,

    We have a requirement where we need to request id of parent filled at the request of the child and the ability to set the parent, status of the request based on the completion status request child.

    I use FND_REQUEST. SUBMIT_REQUEST with sub_request as TRUE to submit an application for the child of the mother's request.

    I followed the code in ' Sample Code for a simultaneous program that submits a request of the child (Doc ID 1616185.1) '

    After using the code, request parent child is is perfectly filled. But am not able to set the status of the parent program based on the completion status of the children's program.

    I tried to use wait_for_request, while loop and same goto to achieve. nothing works and if I use the program of these children goes inactive, Manager of no..

    Any help is greatly appreciated.

    Best regards

    gt1942

    Hi all

    I raised a Bug with the development team and they have confirmed that we can not get the request completion status child when using fnd_request.submit_request with sub_request as TRUE.

    Thus, it is not possible to set the completion status of the request based on the State of completion request child parent.

    Hope this helps others...

    Best regards

    gt1942

  • the query result child parent

    Hi all

    I write the query to the output of the Parent and the child's relationship and would need assistance. Would like to ask someone to help out me.

    I have a table like

    create the table par_chd

    (

    parent_id number (10),

    child_id number (10)

    );

    Who has data like

    SQL > select * from par_chd;

    PARENT_ID, CHILD_ID

    ----------- -----------

    1001 1011

    1001-1021

    1001 1031

    1001-1041

    1021 10210

    1031 10310

    6 selected lines

    I would like to have output as

    PARENT_ID CHILD_LEVEL_1 CHILD_LEVEL_2

    ----------          -------------              -------------

    1001 1011

    1001-1021-10210

    1001-1021

    1001 1031 10310

    1001 1031

    1001-1041

    1001

    7 selected lines

    Thanks in advance

    Saaz

    Hi Saaz,

    Minor adjustment to the script of Moazzam (who made 99% of employment):

    SELECT

    connect_by_root (parent_id),

    CASE

    WHEN LEVEL = 1 THEN child_id

    WHEN LEVEL = 2 THEN PREVIOUSLY child_id

    OTHER prerequisite parent_id

    END CHILD_LEVEL_1

    CASE

    WHEN LEVEL = 2 THEN child_id

    ANOTHER PREREQUISITE Child_id

    END CHILD_LEVEL_2

    CASE

    WHEN LEVEL = 3 THEN child_id

    END CHILD_LEVEL_3

    OF par_chd

    START WITH parent_id = 1001

    CONNECT BY parent_id = child_id PRIOR

    UNION ALL

    SELECT 1001, NULL, NULL, NULL FROM DUAL;

  • expdp/impdp: constraints in the child-Parent relationship

    Hello

    I have a table parent1 and child1, child2 and chld3 tables have foreign key created on this parent1.

    Now, I want to do a delete on parent1. But as the number of records is very high on parent1, we go with expdp / impdp with option querry.

    I took the expdp parent1 level query. Now I dropped parent1 with option of cascade constraints and all foreign keys created by child1, 2 and 3 that parent1 references are automatically deleted.

    Now, if I have the impdp to the query of fire level dump file, are these foreign key constraints will be created automatically on child1, 2 and 3 or I need to manually recreate it?

    Kind regards

    ANU

    Hello
    The CF will not be in the dumpfile - see the code example below where I generate a sqlfile following pretty much the process that you would have done. This is because FK belongs to the DDL for the child table not the parent.

    Connected to:
    Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
    With the Partitioning option
    
    OPS$ORACLE@EMZA3>create table a (col1 number);
    
    Table created.
    
    OPS$ORACLE@EMZA3>alter table a add primary key (col1);
    
    Table altered.
    
    OPS$ORACLE@EMZA3>create table b (col1 number);
    
    Table created.
    
    OPS$ORACLE@EMZA3>alter table b add constraint x foreign key (col1) references a(col1);
    
    Table altered.
    
    OPS$ORACLE@EMZA3>
    
    EMZA3:[/oracle/11.2.0.1.2.DB/bin]# expdp / include=TABLE:\"=\'A\'\"
    
    Export: Release 11.2.0.3.0 - Production on Fri May 17 15:45:50 2013
    
    Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.
    
    Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
    With the Partitioning option
    Starting "OPS$ORACLE"."SYS_EXPORT_SCHEMA_04":  /******** include=TABLE:"='A'"
    Estimate in progress using BLOCKS method...
    Processing object type SCHEMA_EXPORT/TABLE/TABLE_DATA
    Total estimation using BLOCKS method: 0 KB
    Processing object type SCHEMA_EXPORT/TABLE/TABLE
    Processing object type SCHEMA_EXPORT/TABLE/CONSTRAINT/CONSTRAINT
    Processing object type SCHEMA_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS
    . . exported "OPS$ORACLE"."A"                                0 KB       0 rows
    Master table "OPS$ORACLE"."SYS_EXPORT_SCHEMA_04" successfully loaded/unloaded
    ******************************************************************************
    Dump file set for OPS$ORACLE.SYS_EXPORT_SCHEMA_04 is:
      /oracle/11.2.0.3.0.DB/rdbms/log/expdat.dmp
    Job "OPS$ORACLE"."SYS_EXPORT_SCHEMA_04" successfully completed at 15:45:58
    
    Import: Release 11.2.0.3.0 - Production on Fri May 17 15:46:16 2013
    
    Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.
    
    Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
    With the Partitioning option
    Master table "OPS$ORACLE"."SYS_SQL_FILE_FULL_01" successfully loaded/unloaded
    Starting "OPS$ORACLE"."SYS_SQL_FILE_FULL_01":  /******** sqlfile=a.sql
    Processing object type SCHEMA_EXPORT/TABLE/TABLE
    Processing object type SCHEMA_EXPORT/TABLE/CONSTRAINT/CONSTRAINT
    Processing object type SCHEMA_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS
    Job "OPS$ORACLE"."SYS_SQL_FILE_FULL_01" successfully completed at 15:46:17
    
    -- CONNECT OPS$ORACLE
    ALTER SESSION SET EVENTS '10150 TRACE NAME CONTEXT FOREVER, LEVEL 1';
    ALTER SESSION SET EVENTS '10904 TRACE NAME CONTEXT FOREVER, LEVEL 1';
    ALTER SESSION SET EVENTS '25475 TRACE NAME CONTEXT FOREVER, LEVEL 1';
    ALTER SESSION SET EVENTS '10407 TRACE NAME CONTEXT FOREVER, LEVEL 1';
    ALTER SESSION SET EVENTS '10851 TRACE NAME CONTEXT FOREVER, LEVEL 1';
    ALTER SESSION SET EVENTS '22830 TRACE NAME CONTEXT FOREVER, LEVEL 192 ';
    -- new object type path: SCHEMA_EXPORT/TABLE/TABLE
    CREATE TABLE "OPS$ORACLE"."A"
       (    "COL1" NUMBER
       ) SEGMENT CREATION IMMEDIATE
      PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255
     NOCOMPRESS LOGGING
      STORAGE(INITIAL 16384 NEXT 16384 MINEXTENTS 1 MAXEXTENTS 505
      PCTINCREASE 50 FREELISTS 1 FREELIST GROUPS 1
      BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
      TABLESPACE "SYSTEM" ;
    -- new object type path: SCHEMA_EXPORT/TABLE/CONSTRAINT/CONSTRAINT
    ALTER TABLE "OPS$ORACLE"."A" ADD PRIMARY KEY ("COL1")
      USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255
      STORAGE(INITIAL 16384 NEXT 16384 MINEXTENTS 1 MAXEXTENTS 505
      PCTINCREASE 50 FREELISTS 1 FREELIST GROUPS 1
      BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
      TABLESPACE "SYSTEM"  ENABLE;
    -- new object type path: SCHEMA_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS
    DECLARE I_N VARCHAR2(60);
      I_O VARCHAR2(60);
      NV VARCHAR2(1);
      c DBMS_METADATA.T_VAR_COLL;
      df varchar2(21) := 'YYYY-MM-DD:HH24:MI:SS';
     stmt varchar2(300) := ' INSERT INTO "SYS"."IMPDP_STATS" (type,version,flags,c1,c2,c3,c5,n1,n2,n3,n4,n5,n6,n7,n8,n9,n10,n11,n12,d1,cl1) VALUES (''I'',6,:1,:2,:3,:4,:5,:6,:7,:8,:9,:10,:11,:12,:13,NULL,:14,:15,NULL,:16,:17)';
    BEGIN
      DELETE FROM "SYS"."IMPDP_STATS";
      c(1) := 'COL1';
    
      DBMS_METADATA.GET_STAT_INDNAME('OPS$ORACLE','A',c,1,i_o,i_n);
      EXECUTE IMMEDIATE stmt USING 0,I_N,NV,NV,I_O,0,0,0,0,0,0,0,0,NV,NV,TO_DATE('2013-05-17 15:43:24',df),NV;
    
      DBMS_STATS.IMPORT_INDEX_STATS('"' || i_o || '"','"' || i_n || '"',NULL,'"IMPDP_STATS"',NULL,'"SYS"');
      DELETE FROM "SYS"."IMPDP_STATS";
    END;
    /
    

    Kind regards
    Harry

    http://dbaharrison.blogspot.com/

  • How to create a child-parent relationship in ADF

    Hello

    I have 2 tables-> a parent table and another child table.

    Now, I need to create a workflow ADF as on the selection of a row in the parent table, it should display the rows from the related child table the parent table.

    I also want to add/change/remove the data from the two tables.

    Could you please guide me to some tutorial so that I can make the features mentioned above as I'm new to ADF.

    Thank you

    Check this box
    http://www.javacodegeeks.com/2012/10/master-detail-CRUD-operations-with.html
    CRUD operation

    ~ Abhijit

  • Missing child Parent in a merge WebHelp TOC TOC (RoboHTML Version 9.0.2.271)

    Years, I have used Mr Grainge excellent document for fusion Help RoboHTML 8 to produce a WebHelp TOC. Recently I discovered that a child was left out of the merged TOC. Following the instructions (merging the child in the parent TOC, by generating the parent and generating the child) the child does not appear in the parent TOC. I get all the other children, but not the new.

    Any suggestions?

    Have you tried to rebuild all to a new location?

    See www.grainge.org for creating tips and RoboHelp

    @petergrainge

  • Calculation of average in the child-parent relationship

    Hello

    Oracle database version: 11.2.0.1.0

    Currently I'm having a problem of query to calculate the average value. Using the usual average query does not get the result I'm looking for. Because I'm not good with English, I will try to explain for example instead.

    Data table
    COD_A     COD_B     SALES     QTY     PRICE
    0000302     00003               6.09
    0000302     00003               11.7
    0000304     00003               14.08
    0000306     00003               8.87
    0000306     00003     3105     510     4.63
    0000306     00003               4.65
    0000308     00003     18091     1456     12.43
    If I try to calculate the average price of COD_A, I have the correct answer, as expected.
    SELECT COD_A, SUM(SALES), SUM(QTY), AVG(PRICE) FROM VDATATABLE GROUP BY COD_A ORDER BY 1;
    Average price per COD_A
    COD_A     SUM(SALES)     SUM(QTY)     AVG(PRICE)
    0000302                                8.895
    0000304                           14.08
    0000306     3105         510                6.05
    0000308     18091        1456              12.43
    --------------

    If I try to calculate the average price of COD_B, I don't have my expected result.
    SELECT COD_B, SUM(SALES), SUM(QTY), AVG(PRICE) FROM VDATATABLE GROUP BY COD_B ORDER BY 1;
    Average price per COD_B (1)
    COD_B     SUM(SALES)     SUM(QTY)     AVG(PRICE)
    00003     21196             1966              8.92142857142857
    The result I'm looking for is
    WITH W1 AS
    (SELECT COD_B, SUM(SALES) SALES, SUM(QTY) QTY, AVG(PRICE) PRICE FROM VDATATABLE GROUP BY COD_A,COD_B)
    SELECT COD_B, SUM(SALES), SUM(QTY), AVG(PRICE) FROM W1 GROUP BY COD_B;
    Average price of COD_B (2)
    COD_B     SUM(SALES)     SUM(QTY)     AVG(PRICE)
    00003     21196              1966         10.36375
    ---------

    So, the way I want to calculate the average price is the average of the lower child attribute and continue the average to its parent attribute. Currently I can get the result by using the clause, but the hierarchy available not only stops at COD_B, there is more (e.g. COD_C, COD_D, so on), so the foregoing WITH the query "seems" to be inflexible. If I want to ask the COD_C aggregation, I might have to put another COMPONENT in the query.

    So I was wondering is there any other better method to get the result I want? Something more dynamic as a recursive function or integrated maybe?

    Thank you

    Published by: user10620897 on October 19, 2011 04:15

    Hello

    Whenever you have questions, please post CREATE TABLE and INSERT statements for your sample data.
    Always tell what version of Oracle you are using. Don't say something vague, like "11g" in a label where it is easy to miss. Tell exactly what version you have in the body of the message. For example "I'm using Oracle 11.1.0.7.0.

    If you have N levels in the hierarchy, then using subqueries N-1, as you already do, might be the best way.

    If you use Oracle 11.2, you may be able to obtain these results by using a WITH recursive clause.

    Here's another approach to obtain the results desired with a hierarchy of level 2:

    WITH     got_cnt          AS
    (
         SELECT     cod_a, cod_b, sales, qty, price
         ,     COUNT (*) OVER (PARTITION BY cod_a, cod_b)     AS cnt
         FROM     data
    )
    SELECT       cod_b
    ,       SUM (sales)               AS sum_sales
    ,       SUM (qty)                  AS sum_qty
    ,       SUM (price / cnt)
           / COUNT (DISTINCT cod_a)     AS avg_price
    FROM       got_cnt
    GROUP BY  cod_b
    ;
    

    I think you can do this job for any number of levels without adding another subquery for all levels. You may need to add expressions to COUNT more for all levels, and the query only works for a fixed number of levels.

  • How to find records given a child parent key

    I have a main table that is parent for several children tables. I want to display a button to delete a record in the primary table. I would have preferred to see the this key conditionally so when a master record's child records, I don't show button Delete and no error is raised.
    Of course I could scan each child table to find the child records, but I think that must be a generic method

    How can I tell if a given parent key has child records?

    Thanks in advance
    Oscar
    PS: I use 10 gr 2

    Published by: user10712087 on 01/13/2009 14:31

    Oscar

    There is no magic/generic way to verify that a main line has no associated detail line. As says Pavan, you must decide which detail the tables to check and them using SQL as usual. (In fact, there is a quick way - you remove the line if there is no child rows with foreign keys which is not cascade, the delete will fail; but of course you can't use this in case the deletion succeeds and the user never wants to push the button).

    An addition to the Pavan response: DO NOT under any circumstances to count all records in the table of every detail. Everything you want to know is, is it at least 1 record retail at least 1 tables. No need to count the lines 100 or 1000...

    You can do it like this in your PL/SQL

    FUNCTION check_children(p_master_id IN INTEGER) RETURN BOOLEAN
    IS
    
      CURSOR c_child1  IS
      select 1 from child_table_1 where master_id = check_children.p_master_id;
    
      CURSOR c_child2 IS
      select 1 from child_table_2 where master_id = check_children.p_master_id;
    
      -- etc for all child tables
    
    l_rec_present integer := null;
    
    BEGIN
    
        OPEN c_child_1;
        FETCH c_child_1 INTO l_rec_present;
        CLOSE c_child_1;
    
        IF l_rec_present i= 1 THEN
            -- there is a child in child_table_1
            RETURN TRUE;
        END IF;
    
        OPEN c_child_2;
        FETCH c_child_2 INTO l_rec_present;
        CLOSE c_child_2;
    
        IF l_rec_present i= 1 THEN
            RETURN TRUE;
        END IF;
    
    -- etc for each child; finally, if no child found:
    
       RETURN FALSE;
    END;
    

    This made sure that (1) you stop once you find any child, and (2) you get all NO_DATA_FOUND and TOO_MANY_ROWS exceptions thrown.

    HTH

    Nigel cordially

  • Synchronizing with the database for the relationship child parent - several associations is auto created

    JDeveloper version - 11.1.1.7.0


    I created a table say 'table ' have a primary key. Created a new ADF application and using business components of Table added table at my request.


    I then created another table in the database say 'TableChild' have a foreign key reference to a field in thetable '. In my application, I added the TableChild using business components of Table option.


    Associations and/or display of the links between the 2 tables will be created. Also tried to synchronized the OS using the option "Synchronize with the database", but it still reflects. Is it possible to automatically generate associations and post links and/or when a child table is added to the model.

    He is a well-known but in 11.1.1.7.0

    Check what to do with duplicate association which has all the information

    Timo

  • How to separate af:train Train of Parent and child Train

    Dear experts,

    I need to create a form wizard with train and train the child parent. The request is to make parents to train the train left and a child in the middle. The train of the child in the course of parent is hidden.

    Do you have any suggestions?

    The example that I built.

    train.png

    The requirement.

    sampleTrain.png

    Kind regards

    Ricky

    Hello

    Also check link below. I try to apply it. I think it's possible. I will update. Update your version of Jdevloper.

    http://www.Oracle.com/technetwork/developer-tools/ADF/learnmore/externaltrainnavigationpattern-1845645.PDF

    Thank you

    Amey

  • Oracle query convert recursive parent-child level columns

    Dear gurus,

    I have a Hyperion extracted dimension table with my COA in a parent/child layout:

    parent, child

    Acc01, acc001

    acc001, acc0001 etc.

    I need to convert to the:

    level 2, level 1, Level0

    Acc01, acc001, acc0001 etc.

    Please advise, need to feed table table schema for reporting.

    Concerning

    Yannis

    with

    data in the form of

    (select "C01" parent, child 'C001' Union double all the)

    Select 'C001', 'C0001' from dual union all

    Select 'C001', 'C0002"dual union all

    Select "C01", "C002' from dual union all

    Select "C0001', 'C00001' from dual union all

    Select "C00001', 'C000001' from dual union all

    Select 'C000001', 'C0000001' from dual

    )

    Select leve1_1, level_2, level_3, level_4, level_5, level_6

    from (select root0, lvl0, regexp_substr(path,'[^,]+',1,level) VAC, level lvl

    of (lvl0 level select,

    connect_by_root parent root0,

    parent connect_by_root | path of SYS_CONNECT_BY_PATH (Child, ',')

    from the data

    where connect_by_isleaf = 1

    Start with parent (select parent

    data d

    If not exists (select null

    from the data

    where child = d.parent

    )

    )

    connect by prior child = parent

    )

    connect by level<=>

    and prior root0 = root0

    and prior lvl0 = lvl0

    and prior sys_guid() is not null

    )

    Pivot (max (VAC) for lvl 1 as leve1_1, 2 level_2, 3 level_3, 4 level_4, 5 level_5, 6 level_6)

    LEVE1_1 LEVEL_2 LEVEL_3 LEVEL_4 LEVEL_5 LEVEL_6
    C01 C002 - - - -
    C01 C001 C0002 - - -
    C01 C001 C0001 C00001 C000001 C0000001

    Concerning

    Etbin

  • Get the parent-child hierarchy of column delimited

    I've been on this forum once before, and someone helped me, so I hope I can get help again!

    4-15-5987');

    Thus, the hierarchy is divided on the hyphen. first parent being 4245, then the next value is-4 (including the hyphen) and what follows is - 1, for example

    CREATE TABLE REGEXTEST
      ( ITEM VARCHAR(20)); 
    
      INSERT INTO REGEXTEST (ITEM) VALUES ('4245-4');
      INSERT INTO REGEXTEST (ITEM) VALUES ('4245-4-1');
      INSERT INTO REGEXTEST (ITEM) VALUES ('4245-4-10');
      INSERT INTO REGEXTEST (ITEM) VALUES ('4245-4-11');
      INSERT INTO REGEXTEST (ITEM) VALUES ('4245-4-12');
      INSERT INTO REGEXTEST (ITEM) VALUES ('4245-4-13');
      INSERT INTO REGEXTEST (ITEM) VALUES ('4245-4-14');
      INSERT INTO REGEXTEST (ITEM) VALUES ('4245-4-15');
      INSERT INTO REGEXTEST (ITEM) VALUES ('4245-4-15-59A7');
      INSERT INTO REGEXTEST (ITEM) VALUES ('4245-4-15-59D7');
      INSERT INTO REGEXTEST (ITEM) VALUES ('4245-4-15-59F7');
      INSERT INTO REGEXTEST (ITEM) VALUES ('4245-
    
    

    I have to be able to bind-1, -4, 4245. Perhaps the simplest is to build a new table with a primary key where it is assigned the id of the parent to the child.
    I just can't understand how to divide the individual elements and maintain the hierarchy. As previously mentioned, someone helped me with another part of the problem before where I needed to maintain the entire path of each child with the following query:

    select  nvl(prior item,item) parent,
            nvl2(prior item,item,null) child
      from  REGEXTEST
      connect by substr(item,1,instr(item,'-',-1) - 1) = prior item
      order by child,parent
    
    

    Now, if I could extrapolate that into a new table:

    CREATE TABLE FileHierarchy
    (ItemID INT NOT NULL PRIMARY KEY,
    ItemName varchar(50) NOT NULL,
    ParentID INT NULL);
    
    

    ItemName is the 4245 or - 4 or - 1 (only) - Yes, including the hyphen.

    The ID of the parent-1 would be the ID-4, etc...

    Thank you very much in advance!

    J.F. Larente

    Solution for not having stored the high level:

    SQL > select *.
    regextest 2
    3.

    POINT LEV
    -------------------- ----------
    4245 4
    4245 4-1
    4245 4-10
    4245 4-11
    4245 4-12
    4245 4-13
    4245 4-14
    4245 4-15
    4245 4-15-59 A 7
    4245 4-15-59 D 7
    4245-4-15-59F7

    11 selected lines.

    SQL > with t1 as)
    2. Select item
    regextest 3
    4 Union all the
    5 select distinct substr (item, 1, instr(item,'-',1))
    6 of regextest
    7             ),
    8 t2 as)
    9. select element,
    10 row_number() on id (order by article)
    11 from t1
    12              )
    13. select id,
    14 regexp_substr (rtrim (point,'-'), case level when 1 then ' [^-] + $' other '-[^-] + $' end) child.
    parentID 15 prior id,
    16 regexp_substr (prior rtrim (point,'-'), case level - 1 when 1 then ' [^-] + $' other '-[^-] + $' end) parent
    17 of t2
    beginning 18 with substr(item,-1) = '-'
    19 connect by substr (item, 1, instr(item,'-',-1) - 1) = prior rtrim(item,'-')
    20 and article! point prior =
    21.

    ID PARENTID PARENT CHILD
    ---------- -------------------- ---------- --------------------
    1 4245
    2 -4                            1 4245
    3 -1                            2 -4
    4 -10                           2 -4
    5 -11                           2 -4
    6 -12                           2 -4
    7 -13                           2 -4
    8 -14                           2 -4
    9 -15                           2 -4
    10-59A 7 9-15
    11 59 D 7 9 - 15

    ID PARENTID PARENT CHILD
    ---------- -------------------- ---------- --------------------
    12 59F7 9-15

    12 selected lines.

    SQL >

    SY.

  • Get the Parent for each record in the child

    Dear Experts,

    I have a table that contains the parent and child information. I need to make a request to get the parents of each book of the child table. I tried to write the query but does not get the expected results. Please help me.

    Table: relationship

    Parent of the child

    102 101

    103 102

    104 103

    106 105

    107 106

    109 108

    110 109

    Output:

    Expected child

    102 101

    103 102; 101

    104 103, 102, 101

    106 105

    107 106; 105

    109 108

    110 109

    Thank you very much

    Hello

    MU * 443499 * TR wrote:

    Dear Experts,

    I have a table that contains the parent and child information. I need to make a request to get the parents of each book of the child table. I tried to write the query but does not get the expected results. Please help me.

    Table: relationship

    Parent of the child

    102 101

    103 102

    104 103

    106 105

    107 106

    109 108

    110 109

    Output:

    Expected child

    102 101

    103 102; 101

    104 103, 102, 101

    106 105

    107 106; 105

    109 108

    110 109

    Thank you very much

    Why do you want to

    Expected child

    -----  ---------------

    110 109

    Instead of

    Expected child

    -----  ---------------

    110 109; 108

    ?

    You may want something like this:

    CONNECT_BY_ROOT SELECT AS children

    SYS_CONNECT_BY_PATH (parent, ';')  AS expected_output

    FROM table_x

    WHERE CONNECT_BY_ISLEAF = 1

    CONNECT BY child = parent PRIOR

    ;

    If you would care to post CREATE TABLE and INSERT statements for your sample data, and then I could test this.

  • Hierarchy parent child scenario

    Hi friends,

    Im just working on the parent-child hierarchy by using the link below with the sample data.

    http://www.Oracle.com/WebFolder/technetwork/tutorials/OBE/FMW/bi/bi11115/biadmin11g_02/biadmin11g.htm_

    I tried to implement the same hierarchy using my local data instead of referring to the sample data.

    I have a query that returns the Manager as well as the position of the employee at the employee below
    select distinct papf.person_id,  papf.full_name "Employee Name", supf.person_id "Manager Id", supf.full_name "Manager Name", pj.name "Position Name"
    from per_all_people_f papf, per_all_assignments_f paaf, per_all_people_f supf, per_jobs pj
    where papf.person_id = paaf.person_id and supf.person_id = paaf.supervisor_id and paaf.job_id = pj.job_id
    and trunc(sysdate) between paaf.effective_start_date and paaf.effective_end_date and 
    trunc(sysdate) between papf.effective_start_date and papf.effective_end_date
    Im looking forward to implement the same result in my BI with a parent-child hierarchy.

    Since then, I imported three tables to my physical layer
    per_all_people_f------------Dimension
    per_all_assignments_f-----Fact
    per_jobs---------------------Dimension
    For the creation of parent-child in BI, we need to have a table of separate Parent child which consist of four columns like ancestorkey, memberkey, distance, sheet.

    In the column above, I can understand the meaning as
    For Ancestorkey-->Managerid
    Memberkey------->Employeeid
    But I could not the meaning of the column distance as the meaning suggest, as a distance b/w the two column of the worksheet in the sense suggest as one sheet What leaf member it refers.

    I also have the link below then too could not get the feel for it

    http://www.rittmanmead.com/2010/08/Oracle-BI-EE-11g-Parent-Child-Hierarchies-Differing-Aggregations/+.

    How do I train the child parent table for the BI of my three tables above in the HRMS.

    Thank you

    Kind regards
    Saro

    Hi friends,

    I think I found a link to

    http://prasadmadhasi.com/2011/11/15/hierarchies-parent-child-hierarchy-in-OBIEE-11g/

    Let me try this and will update accordingly.

    Thanks for your point of view.

    Kind regards
    Saro

  • composite unique constraint on the values of parent and child?

    Is it possible to have a composite unique constraint that contains the values of the child elements? The example below has the "child" elements are offline, but it's preferred, but optional, I know that you can have a unique constraint in the set of tables without using a reference table that contains the constraint and the two columns. How xdb manages this requirement?

    permit:
    <parent ID="1">
       <child><name>test1</name></child>
       <child><name>test2</name></child>
    </parent>
    <parent ID="2">
       <child><name>test1</name></child>
       <child><name>test2</name></child>
    </parent>
    not allowed:
    <parent ID="1">
       <child><name>test1</name></child>
       <child><name>test1</name></child>
    </parent>
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" 
               xmlns:xdb="http://xmlns.oracle.com/xdb"
               xdb:storeVarrayAsTable="true"
               elementFormDefault="qualified">
        
        <xs:element name="parent" type="Parent_T"
            xdb:columnProps="CONSTRAINT parent_pkey PRIMARY KEY (XMLDATA.ID)"
            xdb:defaultTable="PARENT"/>
    
        <xs:complexType name="Parent_T" xdb:SQLType="PARENT_T" xdb:maintainDOM="false">
            <xs:sequence>
                <xs:element name="child" type="Child_T" minOccurs="1" maxOccurs="unbounded" xdb:SQLName="CHILD"
                          xdb:SQLInline="false" xdb:defaultTable="CHILD" "/>
            </xs:sequence>
            <xs:attribute name="ID" xdb:SQLName="ID" use="required" />
        </xs:complexType>
        
        <xs:complexType name="Child_T" xdb:SQLType="CHILD_T">
           <xs:sequence>
             <xs:element name="name" type="xs:string" xdb:SQLName="NAME"/>
           </xs:sequence>
         </xs:complexType>     
    </xs:schema>
    xdb:columnProps = "CONSTRAINT parent_pkey PRIMARY KEY (XMLDATA.ID), * UNIQUE (XMLDATA.» "Child.Name) *" triggers the non-existent attribute


    A possible solution would be to copy the value of the primary key parent of the child element, then I could create a composite unique constraint using only the values of the child. However, I have this same requirement elsewhere in my lowest nested schema, and it can become messy / bad design with cascading of all primary keys on the schema. For example, I have a recursive element in which two attributes must be unique only within the parent company:
    <parent id="1">
       <child a="1" b="1">
          <child a="1" b="2">
             <child a="1" b="1" /> *not allowed
          </child>
       </child>
       <child a="1" b="2" /> *not allowed
    </parent>
    Possible solution:
    <child a="1" b="2" parent_id="1" />
    <xs:complexType name="Child_T>
       <xs:sequence>
          <xs:element name="child" xsd:SQLInline="false" xsd:columnProps="UNIQUE(XMLDATA.a,XMLDATA.b,XMLDATA.parent_id)" minOccurs="0" maxOccurs="unbounded" type="Child_T">
       </xs:sequence>
       </xs:element
    </xs:complexType>
    Is there a better design?

    Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi 
    PL/SQL Release 10.2.0.4.0 - Production                           
    CORE     10.2.0.4.0     Production                                       
    TNS for Linux: Version 10.2.0.4.0 - Production                   
    NLSRTL Version 10.2.0.4.0 - Production 

    You can do something like this:

    SQL> DECLARE
      2
      3    xsd_doc xmltype := xmltype('
      4  
      5    
      6      
      7        
      8          
      9        
     10      
     11    
     12    
     13      
     14        
     15          
     16        
     17      
     18    
     19    
     20      
     21        
     22          
     23        
     24        
     25      
     26    
     27    
     28      
     29        
     30          
     31        
     32      
     33    
     34  ');
     35
     36  BEGIN
     37
     38    dbms_xmlschema.registerSchema(
     39      schemaURL => 'test_parent.xsd',
     40      schemaDoc => xsd_doc,
     41      local => true,
     42      genTypes => true,
     43      genbean => false,
     44      genTables => false,
     45      enableHierarchy => dbms_xmlschema.ENABLE_HIERARCHY_NONE
     46    );
     47
     48  END;
     49  /
    
    PL/SQL procedure successfully completed
    
    SQL> CREATE TABLE my_xml_table OF XMLTYPE
      2  XMLTYPE STORE AS OBJECT RELATIONAL
      3  XMLSCHEMA "test_parent.xsd"
      4  ELEMENT "root"
      5  VARRAY xmldata."parent" STORE AS TABLE my_parent_tab
      6  (
      7    VARRAY "child" STORE AS TABLE my_child_tab
      8  )
      9  ;
    
    Table created
    
    SQL> ALTER TABLE my_parent_tab ADD CONSTRAINT parent_uk UNIQUE (nested_table_id, "ID");
    
    Table altered
    
    SQL> ALTER TABLE my_child_tab ADD CONSTRAINT child_uk UNIQUE (nested_table_id, "name");
    
    Table altered
     
    

    Then:

    SQL> insert into my_xml_table values (
      2  xmltype('
      3     test1
      4     test2
      5  
      6  
      7     test1
      8     test2
      9  ')
     10  );
    insert into my_xml_table values (
    *
    ERREUR à la ligne 1 :
    ORA-00001: violation de contrainte unique (DEV.PARENT_UK)
    
    SQL> insert into my_xml_table values (
      2  xmltype('
      3     test1
      4     test1
      5  
      6  
      7     test1
      8     test2
      9  ')
     10  );
    insert into my_xml_table values (
    *
    ERREUR à la ligne 1 :
    ORA-00001: violation de contrainte unique (DEV.CHILD_UK)
    
    SQL> insert into my_xml_table values (
      2  xmltype('
      3     test1
      4     test2
      5  
      6  
      7     test1
      8     test2
      9  ')
     10  );
    
    1 ligne créée.
    

    http://download.Oracle.com/docs/CD/B19306_01/AppDev.102/b14259/xdb06stt.htm#sthref987

Maybe you are looking for