Query/right join/

query/right join/
Ultimately we are trying to find the ZZOMTAB.STAFF
I know the value exist because I have queried this by
K_NO
By this query
Select
ZZOMTAB.STAFF
from
ZZOMTAB
where
K_NO = 146735
so it is there
but what I am supplied with is app_no=79219
I have tried this query and it does not work ( no value in the ZZOMTAB.STAFF)
SELECT
     ZZOMTAB.STAFF
FROM TKASERTAB
          RIGHT JOIN ZZOMTAB
          ON TKASERTAB.K_NO = ZZOMTAB.K_NO
          RIGHT JOIN APPTAB
          ON TKASERTAB.app_no= APPTAB.app_no
          where
          APPTAB.app_no=79219
the value that I am trying to get is in ZZOMTAB.STAFF
and I am given with app_no=79219
the tables are
tables are
TKASERTAB with columns K_NO and APPNO
APPTAB with column APPNO
and
ZZOMTAB with K_NO
I am trying to get the value of ZZOMTAB.STAFF
Can someone help??
Thanks in adv

query/right join/
I have tried this query and it does not work ( no
value in the ZZOMTAB.STAFF)
SELECT
     ZZOMTAB.STAFF
FROM TKASERTAB
          RIGHT JOIN ZZOMTAB
          ON TKASERTAB.K_NO = ZZOMTAB.K_NO
          RIGHT JOIN APPTAB
          ON TKASERTAB.app_no= APPTAB.app_no
          where
          APPTAB.app_no=79219
the value that I am trying to get is in
ZZOMTAB.STAFF
and I am given with app_no=79219
Why do You think, that the value must be here ?
Regards
Dmytro

Similar Messages

  • SQL statement that includes LEFT & RIGHT JOIN in the same statement??? Help

    Hi,
    How an I write an SQL statement with a GROUP BY that will both (a) include the NULL value from the left hand table, but also (b) include ALL columns from the right hand table. It's like I need a LEFT JOIN and a RIGHT JOIN in the query at the same time.
    Here's an example of the 2 tables I have and the result I'm after. As you can see I want the NULL's from Expenses Table summed, as well as include all categories from the right hand table (i.e. even if there are no expenses against them)
    Table = Expenses
    Amount Category
    $10 1
    $20 2
    $30 1
    $40 NULL {i.e. not yet categorised}
    Table = Categories
    ID Title
    1 Food
    2 Entertainment
    3 Travel
    4 Personal
    REQUIRED RESULT
    Category Total
    Food 40
    Entertainment 20
    Travel 0
    Personal 0
    NULL 40
    Thanks

    SQL> create table expenses (amount,category)
      2  as
      3  select 10, 1 from dual union all
      4  select 20, 2 from dual union all
      5  select 30, 1 from dual union all
      6  select 40, null from dual
      7  /
    Table created.
    SQL> create table categories (id,title)
      2  as
      3  select 1, 'Food' from dual union all
      4  select 2, 'Entertainment' from dual union all
      5  select 3, 'Travel' from dual union all
      6  select 4, 'Personal' from dual
      7  /
    Table created.
    SQL> select c.title category
      2       , nvl(sum(e.amount),0) total
      3    from expenses e
      4         full outer join categories c on (e.category = c.id)
      5   group by c.id
      6       , c.title
      7   order by c.id
      8  /
    CATEGORY                                       TOTAL
    Food                                              40
    Entertainment                                     20
    Travel                                             0
    Personal                                           0
                                                      40
    5 rows selected.Regards,
    Rob.

  • Why Left and Right Joins if only one of them can serve the same purpose?

    I understand that left join is used to display all the records from left table whereas the right join is used to display all the records from right table in a join.
    However, if we switch the positions of the join tables and perform left join we can get all the records of the left table.
    A left join B -> will give all records from A
    A right join B ->will give all records from B
    B left join A -> will again give all records from B.
    The order in which the data is displayed(ie the field order) can also be maintained in the SELECT clause.
    So, Why do we have left and right joins separately in existance, when only one of them can serve the same purpose?

    Hi,
    I think it's because it is sometime more natural to outer join on left or right.
    In your data model (or the query you are writing), there is some kind of hierarchy between tables : I feel more natural to have the table with lowest hierarchical level (the root table) on the left. So I sometimes prefer to right outer join...
    This is a very personal feeling, I must admit.
    To me what is strange is to have chosen left and right as they refer to a "latin" reading direction => forward join and backward join would be more meaningful for people that read from right to left.
    +And I prefer the new joining syntax that doesn't us the {noformat}(+){noformat} sign...+

  • How  to  do inner join ,outer join, left join ,right join by using infoset

    how  to  do inner join ,outer join, left join ,right join by using infoset

    Hi
    If you want to make  join ,outer join, left join ,right join then its possible if you are using ODS or direct infoobject (In BW3.5) and if you are using BI7.0 then you also make join ,outer join, left join ,right join with Cube also.
    For making join ,outer join, left join ,right join in infosets you just select your info provider then right click on your infoarea from context menu select info set after doing this one pop-up opens here u define your infoset technical name and give either ODS object name of infoobject name.
    After doing this next screen opens in right hand side your selectes ODS or infoobject shows in graphical format .
    and left hand side it shows one menu bar here you can select another ODS or infoobject for making join ,outer join, left join ,right join .just click on ODS button in menu bar and select ODS drag your selected ODS from Left to right after doing this your selected ODS shown in right hand side window in graphical format you just now after doing this you are able to make join ,outer join, left join ,right join for this first you select field from one ods and drag a line from 1 ods to second ods after doing this one arrow is created from one ods to another ods just right click on arrow  and make join ,outer join, left join ,right join in to your ODS.
    I think its clear how we can we make join ,outer join, left join ,right join in infoset.If you have any further query then welcome.
    Assign Points...............
    Thanks and regards
    Ankit modi

  • How to build a query to join on two tables without mapping

    I did Automatic mapping by the workbench Directofield mapping with the table and java object.
    Wanted to build a simple join query by joining on the same field on both the tables.Not the sql query through the toplink using expression builder.
    Please help.............
    Spent one full day for this................

    Thanks Don for the reply,sorry to bug you,but i need help.....
    SELECT A.AGNCY_C,
         A.TYPE_C,
         A.RESN_C,
         A.S_TYPE_C,
         A.SUB_ID_C,
         A.RY_C
    FROM RATING A, REF B
    WHERE A.ID_C = B._ID_C
    AND A.ALPHA_C = B.ALPHA_C
    AND A.EFF_D >= B.MATURITY_D
    This is the real query i was talking about.I did mapping automatically through the workbench,generated java classes also throught the workbench.
    Now they don't want to execute the raw sql.They wanted to get all the RATING objects with the where condition.
    So how to build a query by using toplink.
    tried your example
    ExpressionBuilder builder = new ExpressionBuilder();
    Expression creditRating = builder.getTable("RATING").getField("ID_C");
    Expression issue_ref = builder.getTable("REF").getField("ID_C");
    Expression join = creditRating.equal(issue_ref);
    I am getting java.lang.OutOfMemoryError
    error.
    I selected the option generate classes and descriptors
    from the tables (RATING,REF).,so it created the classes and dscriptors automatically.
    In Database script for the table RATING like this
    ALTER TABLE RATING ADD (
    CONSTRAINT RATING_F1 FOREIGN KEY (ID_C, ALPHA_C)
    REFERENCES REF (ID_C,ALPHA_C));
    I think when i generate descriptor automatically it is keeping this association.
    Please help me.........

  • Query to join 2 tables by interval of value

    Hi all
    I need your help in creating a query to join 2 tables by interval of values.
    The thing i want to d ois like this: i have 2 tables the first one containing list of serial number and the secon is containing interval of serial number (startnumber and end number) and other information like the user creating the serial number.
    I want to list all serial numbers from the first table and the user creating each serial number from the second one if the serial number is between each interval of the second table.
    here is an example>
    SQL> create table test1 (code varchar2(1), serial number);
    Table created.
    SQL> create table test2 (requester varchar2(10),startno number, endno number);
    Table created.
    SQL> insert into test1 values('A',1);
    1 row created.
    SQL> insert into test1 values('B',3);
    1 row created.
    SQL> insert into test1 values('C',8);
    1 row created.
    SQL> insert into test1 values('D',12);
    1 row created.
    SQL> insert into test1 values('E',20);
    1 row created.
    SQL> commit;
    Commit complete.
    SQL> insert into test2 values('TATA',1,5);
    1 row created.
    SQL> insert into test2 values('TOTO',6,10);
    1 row created.
    SQL> commit;
    Commit complete.
    The result i want to get are:
    TESt1.CODE     TEST2.REQUESTER
    A          TATA
    B          TATA
    C          TOTO
    D          null
    E          null

    Use outer join:
    select  code,
            requester
      from  test1,
            test2
      where serial between startno(+) and endno(+)
      order by code
    C REQUESTER
    A TATA
    B TATA
    C TOTO
    D
    E
    SQL> SY.

  • Need complex query  with joins and AGGREGATE  functions.

    Hello Everyone ;
    Good Morning to all ;
    I have 3 tables with 2 lakhs record. I need to check query performance.. How CBO rewrites my query in materialized view ?
    I want to make complex join with AGGREGATE FUNCTION.
    my table details
    SQL> select from tab;*
    TNAME TABTYPE CLUSTERID
    DEPT TABLE
    PAYROLL TABLE
    EMP TABLE
    SQL> desc emp
    Name
    EID
    ENAME
    EDOB
    EGENDER
    EQUAL
    EGRADUATION
    EDESIGNATION
    ELEVEL
    EDOMAIN_ID
    EMOB_NO
    SQL> desc dept
    Name
    EID
    DNAME
    DMANAGER
    DCONTACT_NO
    DPROJ_NAME
    SQL> desc payroll
    Name
    EID
    PF_NO
    SAL_ACC_NO
    SALARY
    BONUS
    I want to make  complex query  with joins and AGGREGATE  functions.
    Dept names are : IT , ITES , Accounts , Mgmt , Hr
    GRADUATIONS are : Engineering , Arts , Accounts , business_applications
    I want to select records who are working in IT and ITES and graduation should be "Engineering"
    salary > 20000 and < = 22800 and bonus > 1000 and <= 1999 with count for males and females Separately ;
    Please help me to make a such complex query with joins ..
    Thanks in advance ..
    Edited by: 969352 on May 25, 2013 11:34 AM

    969352 wrote:
    why do you avoid providing requested & NEEDED details?I do NOT understand what do you expect ?
    My Goal is :
    1. When executing my own query i need to check expalin plan.please proceed to do so
    http://docs.oracle.com/cd/E11882_01/server.112/e26088/statements_9010.htm#SQLRF01601
    2. IF i enable query rewrite option .. i want to check explain plan ( how optimizer rewrites my query ) ? please proceed to do so
    http://docs.oracle.com/cd/E11882_01/server.112/e16638/ex_plan.htm#PFGRF009
    3. My only aim is QUERY PERFORMANCE with QUERY REWRITE clause in materialized view.It is an admirable goal.
    Best Wishes on your quest for performance improvements.

  • SQL query -- self-join question?

    SQL> l
    1* select originator,destination,oaddress,daddress from (select * from activity where rownum<=3)
    SQL> /
    10099 10004 16196344392 16199375530
    10064 10002 18454644069 18456563415
    10065 10006 18302650166 16416609306
    looking at the above query, i am just performing a simple select from one of my tables. Now i require the carriername for both originator and destination columns, and the names for these are found on another table carrier.
    so, i am re-write the above query as: (join with carrier table)
    SQL>
    SQL> select originator,destination,oaddress,daddress,carriername from (select * from activity,carrier where originator=carrier_code and rownum<=3);
    10006 10099 19182772772 19189553062 USA1
    10004 10311 15096701636 15096692171 USA2
    10000 10003 15125898141 15122930569 USA3
    Now, i got the carrier name for my originator, how would i find the carriername for my destination also (in the same query). One way of doing it is joining the carrier table twice, but is there any other better approach.
    Hope i am clear, any help will be greatly appreciated. Thanks.

    select
             A.originator, A.destination, A.oaddress, A.daddress
           , B.carrier_name name_originator
           , C.carrier_name name_destination
       from
             activity  A
            ,carrier  B
            ,carrier  C
      where
             A.originator  = B.carrier_code
         and A.destination = C.carrier_code

  • Error in update query with join

    hi all,
    im using oracle 10g in windows.
    im not able to use this update query having join......
    UPDATE
    b
    SET
    b.is_stud = 1
    FROM
    boy b
    INNER JOIN
    relationship r
    ON
    b.id = r.boy_id;
    thanks a lot..................

    887268 wrote:
    hi, thanks,,,,,,,,,
    create table emp ( id,name,date,empno);
    create table emp_status(slno,ename,empno);
    i need to update "emp.name" in "emp" table from "emp_status.ename"
    where emp.empno=emp_status.empno;
    i.e) for all matched "empno" from both table, update "emp.name" from "emp_status.ename"Whats the relationship between emp and emp_status tables? If there exists one to one mapping for empno in both tables, then try
    update emp e
    set    e.name = (select es.ename
                     from   emp_status es
                     where  e.empno = es.empno)

  • What is left join /right join / out join/ inner join/please give example!

    what is left join /right join / out join/ inner join/please give example!
    thanks

    Maybe these examples will give you an idea...
    SQL> select * from t1;
            ID
             1
             2
             3
             4
    SQL> select * from t2;
            ID
             3
             4
             5
             6
    -- LEFT OUTER JOIN
    SQL> select t1.id, t2.id
      2  from t1 LEFT OUTER JOIN t2 ON (t1.id = t2.id);
            ID         ID
             3          3
             4          4
             1
             2
    -- RIGHT OUTER JOIN
    SQL> select t1.id, t2.id
      2  from t1 RIGHT OUTER JOIN t2 ON (t1.id = t2.id);
            ID         ID
             3          3
             4          4
                        6
                        5
    -- LEFT JOIN (SAME AS LEFT OUTER JOIN)
    SQL> ed
    Wrote file afiedt.buf
      1  select t1.id, t2.id
      2* from t1 LEFT JOIN t2 ON (t1.id = t2.id)
    SQL> /
            ID         ID
             3          3
             4          4
             1
             2
    -- RIGHT JOIN (SAME AS RIGHT OUTER JOIN)
    SQL> ed
    Wrote file afiedt.buf
      1  select t1.id, t2.id
      2* from t1 RIGHT JOIN t2 ON (t1.id = t2.id)
    SQL> /
            ID         ID
             3          3
             4          4
                        6
                        5
    -- INNER JOIN (REGULAR JOIN)
    SQL> ed
    Wrote file afiedt.buf
      1  select t1.id, t2.id
      2* from t1 INNER JOIN t2 ON (t1.id = t2.id)
    SQL> /
            ID         ID
             3          3
             4          4
    -- FULL OUTER JOIN
    SQL> ed
    Wrote file afiedt.buf
      1  select t1.id, t2.id
      2* from t1 FULL OUTER JOIN t2 ON (t1.id = t2.id)
    SQL> /
            ID         ID
             3          3
             4          4
             1
             2
                        6
                        5
    6 rows selected.
    SQL>

  • Write the following query using JOIN keyword ?

    Qest:
    Write the following query using JOIN keyword ?
    select ID_category from category_master X
    where Exist(select 1 from sub_category Y where
    X.ID_category=Y.ID_category)Edited by: 799660 on Oct 3, 2010 6:05 AM

    select  X.ID_category
      from  category_master X join (select distinct ID_category from sub_category) Y
             on (X.ID_category=Y.ID_category)
    /SY.

  • Translate JOIN syntax from LEFT JOIN, RIGHT JOIN to (+)

    I have looked through a lot of documentation, but have yet to see some concreate examples of how to code a JOIN when you are used to LEFT, RIGHT JOIN, etc.
    Could someone translate these, removing the LEFT OUTER JOIN, etc. and replace with the (+). I am fairly new to Oracle and have been using the others all along?
    SELECT *
    FROM LOCATION L
    LEFT OUTER JOIN DEPT D
    ON (L.LocationID = D.LocationID)
    LEFT OUTER JOIN EMPLOYEE E
    ON (D.DeptID = E.DeptID);
    SELECT *
    FROM EMPLOYEE E
    RIGHT OUTER JOIN DEPT D
    ON (D.DeptID = E.DeptID)
    RIGHT OUTER JOIN LOCATION L
    ON (L.LocationID = D.LocationID);
    SELECT *
    FROM LOCATION L
    FULL JOIN DEPT D
    ON (L.LocationID = D.LocationID)
    FULL JOIN EMPLOYEE E
    ON (D.DeptID = E.DeptID);
    Thank you.

    However,
    select  b.*
    from    table_a a
    ,       table_b b
    where   a.user_id = b.userid(+);<=>
    select          b.*
    from            table_a a
    left outer join table_b b
    on              b.user_id = a.user_idand
    select  b.*
    from    table_a a
    ,       table_b b
    where   a.user_id(+) = b.userid;<=>
    select            b.*
    from              table_a a
    right outer join  table_b b
    on                b.user_id = a.user_idI'm not sure about the full join.
    Edit:
    Ah, yes, I remember. The only way to do a full outer join with Oracle syntax (that I'm aware of) is to use UNION:
    select  b.*
    from    table_a a
    ,       table_b b
    where   a.user_id(+) = b.userid;
    union
    select  b.*
    from    table_a a
    ,       table_b b
    where   a.user_id = b.userid(+);

  • 2 right joins - how to add another right join to this statement?

    Hi all,
    I had to upgrade my sql statement and add another column. my previuos sql was:
              SELECT TR.ID, TA.Name, TR.idTarget, TR.Controller_Status, TR.previuosYear, TR.deduction, TR.idProduction, SUM(CSV.cur_amount) AS Accumulated,    PD.Name AS PName, PD.type_2, CL.ToRange AS growth
              FROM agent AS TA, production_name AS PD, calculation AS CL, target AS TR
              RIGHT JOIN csv_production AS CSV ON CSV.ID=TR.ID AND CSV.Production_Date BETWEEN '2006-10-01' AND '2006-12-31'
              WHERE TA.ID=TR.ID
              AND PD.idProduction = TR.idProduction
              AND CL.idCalculation = ANY (SELECT MIN(idCalculation) FROM calculation GROUP BY idProduction)
              AND TR.idProduction=CL.idProduction
              AND TR.startDate= '2006-10-01' AND TR.endDate='2006-12-31'
              GROUP BY CSV.IDI had to add this line:
    RIGHT JOIN csv_net_production AS CSV_net ON CSV_net.IATA=TR.IATA AND CSV_net.Production_Date BETWEEN '2006-10-01' AND '2006-12-31'  my end result looks like this:
              SELECT TR.ID, TA.Name, TR.idTarget, TR.Controller_Status, TR.previuosYear, TR.deduction, TR.idProduction, SUM(CSV.cur_amount) AS Accumulated,  SUM(CSV_net.cur_amount) AS net_Accumulated, PD.Name AS PName, PD.type_2, CL.ToRange AS growth
              FROM agent AS TA, production_name AS PD, calculation AS CL, target AS TR
              RIGHT JOIN csv_production AS CSV ON CSV.ID=TR.ID AND CSV.Production_Date BETWEEN '2006-10-01' AND '2006-12-31'
                               RIGHT JOIN csv_net_production AS CSV_net ON CSV_net.ID=TR.ID AND CSV_net.Production_Date BETWEEN '2006-10-01' AND '2006-12-31' 
              WHERE TA.ID=TR.ID
              AND PD.idProduction = TR.idProduction
              AND CL.idCalculation = ANY (SELECT MIN(idCalculation) FROM calculation GROUP BY idProduction)
              AND TR.idProduction=CL.idProduction
              AND TR.startDate= '2006-10-01' AND TR.endDate='2006-12-31'
              GROUP BY CSV.IDBUT!!! the accumulated (Accumulated, net_Accumulated,) is multiplied by 3, which means that I must add another WHERE statement (i think?!)
    thanks for any pointers

    how do u relate csv_production ,csv_net_production ?
    the one comparison i viewed is TR.ID against the IDs of these 2 tables
    I mean
    is there any relationship between these 2 tables?
    specifically
    is there any referencial integrity or like constraint exists between these 2 tables?
    if so u can write a where condition csv_production.ID=csv_net_production.ID

  • Select Query using Joins

    Hi,
    Please give me the Select query
    I have to fetch   EBELN,BUKRS,LIFNR,BSART,EKORG,EKGRP,WAERS,WKURS  from EKKO and
                          EBELP,LGORT,MATKL ,WERKS,BEDNR,IDNLF,BPRME,NETPR   from EKPO and
                         MENGE, SAKTO,AUFNR,ANLN1,GSBER,PS_PSP_PNR                from EKKN and
                         LPEIN,EINDT,SLFDT,                                                                    from EKET.
    I have to fetch all the data into an single internal table(Mandatory) by a select query using Joins.
    EKKO is having EBELN as primary key
    EKPO is having EBELN,EBELP as primary key
    EKKN is having EBELN,EBELP as primary key
    EKET is having EBELN,EBELP as primary key
    Can anybody Please give me the Select query.
    With Regards
    Ajay

    Hi ,
    I am sending this sample coed for the Inner joins .Hope this will help you:
    Inner joins using 3 tables 
    Try this :-
    SELECT stpostlnr stpoidnrk mastmatnr maramtart stpo~menge 
    INTO CORRESPONDING FIELDS OF TABLE zmat1 FROM mast 
    JOIN stpo ON stpostlnr = maststlnr 
    JOIN mara ON maramatnr = mastmatnr 
    WHERE stpostlty = 'M' "AND stpoidnrk IN s_matnr 
    AND mast~werks = 1000. 
    Here s_matnr is a select-options on the selection-screen. 
    Or this. 
    Code: 
         Select single VbrkBukrs VbrkKunrg    Vbrk~Vbeln 
                       VbrkFkdat VbrkBstnk_Vf Vbrk~Zterm 
                       Tvzbt~Vtext 
                       VbakVbeln VbakBstdk 
                       LikpVbeln Likplfdat    Likp~Lfuhr 
           into w_vbrk 
           from vbrk 
          inner join       Tvzbt on TvzbtZterm        = VbrkZterm      and 
                                    Tvzbt~Spras        = sy-langu 
          Inner join       Vbfa  as SalesLnk 
                                 on SalesLnk~vbeln     = pu_vbeln        and 
                                    SalesLnk~vbtyp_v   = c_order 
                inner join Vbak  on VbakVbeln           = SalesLnkVbelv
          Inner join       Vbfa  as DeliveryLnk 
                                 on DeliveryLnk~vbeln   = pu_vbeln       and 
                                    DeliveryLnk~vbtyp_v = c_Delivery 
                inner join Likp  on LikpVbeln          = DeliveryLnkVbelv 
          where vbrk~vbeln = pu_Vbeln. 
    This code locates sales, delivery and payment terms info from a billing document number. 
    or
    Here, this one also works fine :
    select zfpcdcadivi zfpcdproforma zfpcdfactura zfpcdaniofactura 
    zfpcdmontousd zfpcdmontoap zfpcdebeln zfpcdinco1 
    zfpcdlifnr lfa1name1 zcdvsstatus zfpcdconint 
    into it_lista 
    from zfpcd inner join zcdvs 
    on zfpcdebeln = zcdvsebeln 
    and zfpcdproforma = zcdvsproforma 
    and zfpcdlifnr = zcdvslifnr 
    inner join lfa1 
    on zfpcdlifnr = lfa1lifnr 
    where zcdvs~status = '04'. 
    Also Here is another solution that just uses inner joins:
    SELECT vbakvbeln vbfaerdat INTO (itab-vbeln, itab-wadat)
    FROM ( vbak INNER JOIN vbap
    ON vbapvbeln = vbakvbeln )
    INNER JOIN vbfa ON vbakvbeln = vbfavbelv
    WHERE vbak~kunnr = m_wm AND
    vbak~vbtyp = 'C' AND
    vbfa~erdat IN s_date AND
    vbap~matnr = 'MZ1807F' AND
    vbfaposnv = vbapposnr AND
    vbfa~vbtyp_n = 'J'.
    <REMOVED BY MODERATOR>
    Cheers,
    Chandra Sekhar.
    Edited by: Alvaro Tejada Galindo on Apr 10, 2008 5:20 PM

  • Who to query and join nested elements

    I have a table that contains a XMLTYPE Field. How do I query and join nested elements. For example I have a schema that has a PerstrenList element that holds one or more Perstren nodes.  The Perstren node will contain a RemarksList node that can contain one or more Remarks nodes.  My goal is to query all of the Remarks and join them with the information in it's parent node. Without the parent node information the remark is meaningless.  Following is a example document and desire result set. I know how to query the Perstren or the Remarks I just can not figure out how to marry the two. The query should only return the remarks joined with the parent information.
    <RasDataSet>
       <PerstrenList>
            <Perstren>
               <TPERS>A</TPERS>
               <DEPLY>B</DEPLY>
               <STRUC>5</STRUC>
               <RemarksList>
                   <REMARK>
                        <LABEL>ABC</LABEL>
                        <GENTEXT>Hello world</GENTEXT>
                   </REMARK>
                   <REMARK>
                        <LABEL>XYZ</LABEL>
                        <GENTEXT>Oracle XML</GENTEXT>
                   </REMARK>
               <RemarksList>
            </Perstren>
            <Perstren>
           <TPERS>C</TPERS>
           <DEPLY>D</DEPLY>
           <STRUC>4</STRUC>
           <RemarksList>
               <REMARK>
                    <LABEL>EFG</LABEL>
                    <GENTEXT>Database</GENTEXT>
               </REMARK>
           <RemarksList>
            </Perstren>
            <Perstren>
           <TPERS>E</TPERS>
           <DEPLY>F</DEPLY>
           <STRUC>3</STRUC>
            </Perstren>       
       <PerstrenList>
    </RasDataSet>
    desired Results
    TPERS  DEPLY   LABEL  GENTEXT
    A       B       ABC   Hello World
    A       B       XYZ   Oracle XML
    C       D       EFG   Database
    select uic,
            extractvalue(Column_value,'/Perstren/TPERS') as TPERS,
            extractvalue(Column_value,'/Perstren/DEPLY') as DEPLY,
            extractvalue(Column_value,'/Perstren/SECUR') as SECUR,
            extractvalue(Column_value,'/Perstren/STRUC') as STRUC,
            extractvalue(Column_value,'/Perstren/TIME') as TIME,
            extractvalue(Column_value,'/Perstren/AUTH') as AUTH,
            extractvalue(Column_value,'/Perstren/ASGD') as ASGD,
    from test_ref doc,
        table(XMLSequence(extract(doc.XML_DOC,'/RasDataSet/PerstrenList/Perstren'))) per
    [pre]                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

    Sorry my Pre tag was in the wrong place Text reads:
    I have a table that contains a XMLTYPE Field. How do I query and join nested elements. For example I have a schema that has a PerstrenList element that holds one or more Perstren nodes. The Perstren node will contain a RemarksList node that can contain one or more Remarks nodes. My goal is to query all of the Remarks and join them with the information in it's parent node. Without the parent node information the remark is meaningless. Following is a example document and desire result set. I know how to query the Perstren or the Remarks I just can not figure out how to marry the two. The query should only return the remarks joined with the parent information.
    Sorry my Pre tag was in the wrong place

Maybe you are looking for

  • P35 Neo 2 LED Code, What does it mean?

    Computer won't boot, stops at splash screen, can't get into bios. Hangs on LED code G-R-G-R "Testing Base and  Extended Memory..." Tried booting with only the bare essentials, same code. Tried booting with no memory, hangs on "Memory Detection Test"

  • Problem since version update... help please....

    Hi there, just wondering if anyone can help? Since updating iTunes this morning it doesn't recognise any audio CD's, it plays and imports to library OK but it's not retrieving any information (Artist, tracks, etc.), i've tried a few different disks b

  • What tables contain data for the CUP requests in 5.3?

    What are all of the tables that contain the data that appears in the CUP requests?  We are on version 5.3 SP13. We are selling off one of the divisions of our company and one of the terms is that we have to provide all relevant data, including CUP re

  • How do I get extra authorisation for iTunes?

    Hi there one and all, Does anyone know the best route to get additional authorisations for iTiunes, as I havce 14 computers wanting to use the same Apple ID? Thanks.

  • Creating Gradient Swatches

    I am trying to create a gradient swatch to fill a rectangle on a brochure but it wont let me select a beginning stop color. Is there a process I am missing? I go to the swatches menu in the top right corner of my document, then select create new grad