XMLSequence EXTRACT HEAD and DETAIL in ORACLE 9.2

Hi, sorry about my english i am from argentine.
I have this XML:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<arrayOfServicio >
    <Servicio>
        <Nombre>Autenticacion</Nombre>
        <Descripcion>ws</Descripcion>
        <Activo>true</Activo>
        <Version>1.0</Version>
        <MetodosEntity>
            <Metodo>
                <Nombre>RequestTicket</Nombre>
                <Activo>true</Activo>
                <Version>1.0</Version>
            </Metodo>
        </MetodosEntity>
    </Servicio>
    <Servicio>
        <Nombre>Consultas</Nombre>
        <Descripcion>wsConsultas</Descripcion>
        <Activo>true</Activo>
        <Version>1.0</Version>
        <MetodosEntity>
            <Metodo>
                <Nombre>GetVigencia</Nombre>
                <Activo>true</Activo>
                <Version>1.0</Version>
            </Metodo>
            <Metodo>
                <Nombre>GetSiniestralidad</Nombre>
                <Activo>true</Activo>
                <Version>1.0</Version>
            </Metodo>
            <Metodo>
                <Nombre>GetAgrupados</Nombre>
                <Activo>true</Activo>
                <Version>1.0</Version>
            </Metodo>
            <Metodo>
                <Nombre>GetSiniestralidadPorCuil</Nombre>
                <Activo>true</Activo>
                <Version>1.0</Version>
            </Metodo>
        </MetodosEntity>
    </Servicio>
    <Servicio>
        <Nombre>Referencias</Nombre>
        <Descripcion>wsReferencias</Descripcion>
        <Activo>true</Activo>
        <Version>1.0</Version>
        <MetodosEntity>
            <Metodo>
                <Nombre>TablaReferencia</Nombre>
                <Activo>true</Activo>
                <Version>1.0</Version>
            </Metodo>
            <Metodo>
                <Nombre>ListadoReferencia</Nombre>
                <Activo>true</Activo>
                <Version>1.0</Version>
            </Metodo>
        </MetodosEntity>
    </Servicio>
    <Servicio>
        <Nombre>General</Nombre>
        <Descripcion>WsGeneral</Descripcion>
        <Activo>true</Activo>
        <Version>1.0</Version>
        <MetodosEntity>
            <Metodo>
                <Nombre>GetServicios</Nombre>
                <Activo>true</Activo>
                <Version>1.0</Version>
            </Metodo>
        </MetodosEntity>
    </Servicio>
    <Servicio>
        <Nombre>eServicios</Nombre>
        <Descripcion>wseServicios</Descripcion>
        <Activo>true</Activo>
        <Version>1.0</Version>
        <MetodosEntity>
            <Metodo>
                <Nombre>SetComunicacion</Nombre>
                <Activo>true</Activo>
                <Version>1.0</Version>
            </Metodo>
        </MetodosEntity>
    </Servicio>
    <Servicio>
        <Nombre>VentanillaART</Nombre>
        <Descripcion>wsVentanillaART</Descripcion>
        <Activo>true</Activo>
        <Version>1.0</Version>
        <MetodosEntity>
            <Metodo>
                <Nombre>ObtenerNovedades</Nombre>
                <Activo>true</Activo>
                <Version>1.0</Version>
            </Metodo>
        </MetodosEntity>
    </Servicio>
    <Servicio>
        <Nombre>Establecimientos</Nombre>
        <Descripcion>wsEstablecimiento</Descripcion>
        <Activo>true</Activo>
        <Version>1.0</Version>
        <MetodosEntity>
            <Metodo>
                <Nombre>GetConsultaPorCuit</Nombre>
                <Activo>true</Activo>
                <Version>1.0</Version>
            </Metodo>
        </MetodosEntity>
    </Servicio>
</arrayOfServicio>
I am working in ORACLE 9.2 and i wrote this query but the result is not correct, i need to join HEAD and DETAIL in some way but cannot do that...
  select extractvalue(value(head),'//Servicio/Nombre/text()') ,
        extractvalue(value(head),'//Servicio/Descripcion/text()'),
        extractvalue(value(head),'//Servicio/Activo/text()'),
        extractvalue(value(head),'//Servicio/Version/text()')
        ,extractvalue(value(detail),'//Metodo/Nombre/text()')
        ,extractvalue(value(detail),'//Metodo/Activo/text()')
        ,extractvalue(value(detail),'//Metodo/Version/text()')
  from arwt_ws_return x
      , table(xmlsequence(extract (x.x_xmldoc, '/arrayOfServicio/Servicio'))) head
      , table(xmlsequence(extract (x.x_xmldoc, '/arrayOfServicio/Servicio/MetodosEntity/Metodo'))) detail;
Ii really appreciate your help.
Thanks!

Hi,
You can do that by passing the head element to the second XMLSequence. That way you maintain the correlation between the parent and its children :
select extractvalue(value(head), '/Servicio/Nombre') as srv_nombre
     , extractvalue(value(head), '/Servicio/Descripcion') as srv_desc
     , extractvalue(value(head), '/Servicio/Activo') as srv_activo
     , extractvalue(value(head), '/Servicio/Version') as srv_version
     , extractvalue(value(detail), '/Metodo/Nombre') as met_nombre
     , extractvalue(value(detail), '/Metodo/Activo') as met_activo
     , extractvalue(value(detail), '/Metodo/Version') as met_version
from arwt_ws_return x
   , table(xmlsequence(extract(x.x_xmldoc, '/arrayOfServicio/Servicio'))) head
   , table(xmlsequence(extract(value(head), '/Servicio/MetodosEntity/Metodo'))) detail
Please also note that :
- you don't need a descendant axis (//) if you know the exact path
- you don't need to go down to the text() node if you're using extractvalue
Hope that helps.

Similar Messages

  • Keeping heading and detail on the same page

    Hi, I have a report with a group header section and a detail section.  How can I keep the heading section and all the detail section on the same page without starting each group on a new page?
    The detail section will have either 2 or 3 records with some of the objects set to grow if the data doesn't fit on one line.  This results in several changes of group appearing on the same page which is what I want.  However, what I don't want is the header section on one page with the detail section on the next, or the header and some of the detail records on one page with the rest of the detail records on the next.  What I would like is the report to start a new page if the header and all the detail records don't fit on the same page but without starting a new page for every group change.  How can I achieve this?

    you can put the group header and details into a sub report on the old group header section.
    then hide the details section

  • File content conversion - sender adapter for Header and detail records

    Hi Experts,
                     I am receiving a field of fixed length content format.(Header)The first line of the file will follow the structure X having some fields and (DetailRecord)subsequent lines in the file will follow structure Y having somes fields.There is no record identifier for Header and Detail records.In one file first line is Header records and remaining subsequent line is DetailRecord.What are the parameters we have to set for sender file content conversion parameters as i donot have any key field and key field value.And in one file we have only one header records ( first line) and n number of detail records from 2nd line onwards.
    Thanks
    Deepak

    Hi
    Refer the below fourm link,
    Flat file whitout id
    Regards
    Ramg.

  • Populate header and detail

    Hi,
    I have an internal table with the value below. I need to populate to header data line (1 record only)  and detail is an internal table
    When there is a change of customer, i need to copy 123 to header and 2 records of material (abc & xed), sales (100 & 200) and qty (10 & 12) to detail internal table.
    for customer 567, i need to copy to header and material aqs, sales 150 and qty 5 to detail internal table.
    May I know how can I achieve this?
    customer     material        sales      qty
    123              abc              100         10
    123              xed              200          12
    567              aqs              150           5
    877              abc               140         8
    Thanks
    Rgds

    Hello,
    As per my understanding, your requirement is that you have an internal table which has a combined data and you want to split it into headr and detail internal tables, based on the change of the customer number which is the first field in the combined internal table. If so then assume that it_com is the combined internal table and it_head and it_det as the header and detail interbnal tables respectively.
    First sor the combined internal table on customer number
    sort it_com by kunnr.
    Now loop across this table and on the event at new customer populate the header table and in the remaining loop populate the detail table.
    loop at it_com into wa_com.
      at new kunnr.
         wa_head-kunnr = wa_com-kunnr.
         append wa_head-kunnr to it_head-kunnr.
         clear wa_head-kunnr.
      endat.
    append the records from the combined table into the item table, whatever fields required
    endloop.
    Regards,
    Sachin

  • DMEE issue in header and detail record

    Hi Gurs,
    I am working in DMME payment medium .
    I have declared DMEE  header structure(00000001000001 ) as level 1 and detail (050000010020192             XX110000001) as also level 1.
    This is the output format i am getting.
    00000001000001                                                                               
    05000001002000             XX110000001                                                                               
    00000001000001                                                                               
    05000001002012            XX110000002                                                                               
    00000001000001                                                                               
    05000001002012             XX110000003                                                                00000001000001                                                                               
    05000001002011             XX110000004           
    But my requirment not lke this. i need to dispaly all detail items under one header also i need to increase the counter for every items starting from 2.
    Both header and detail are at  level 1.If i declared the detail as level 2 the output is not generated.
    This is what i need.                                                                               
    00000001000001                                                                               
    05000002002000             XXX110000001                                                        
    05000003002012             XXX110000002
    05000004002012             XXX110000003
    05000005002011             XXX110000004 
    Pls suggest me any solutions
    Thanks .

    NOT answered

  • DMEE Issues header and detail record

    Hi Gurs,
    I am working in DMME(PAYM) payment medium .
    I have declared DMEE header structure(00000001000001 ) as level 1 and detail (050000010020192 XX110000001) as also level 1.
    This is the output format i am getting.
    00000001000001
    05000001002000 XX110000001
    00000001000001
    05000001002012 XX110000002
    00000001000001
    05000001002012 XX110000003 00000001000001
    05000001002011 XX110000004
    But my requirment not lke this. i need to dispaly all detail items under one header also i need to increase the counter for every items starting from 2.
    Both header and detail are at level 1.If i declared the detail as level 2 the output is not generated.
    This is what i need.
    00000001000001
    05000002002000 XXX110000001
    05000003002012 XXX110000002
    05000004002012 XXX110000003
    05000005002011 XXX110000004
    Pls suggest me any solutions
    Thanks .
    Edited by: bala chandran on Oct 9, 2009 10:57 AM

    NOT answered

  • Pivot with header and details

    I need to display data from both header and detail, details has to come from other table also
    --CREATE TABLE
    CREATE TABLE [dbo].[Table_Dept](
    [DeptId] [int] NULL,
    [DeptCode] [char](2) NULL,
    [DeptName] [nvarchar](100) NULL
    ) ON [PRIMARY]
    CREATE TABLE [dbo].[Table_Detail](
    [Header_ID] [int] NOT NULL,
    [Name] [nvarchar](50) NOT NULL,
    [DescValue] [nvarchar](max) NULL
    ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
    CREATE TABLE [dbo].[Table_Header](
    [Header_Id] [int] NULL,
    [UserName] [nvarchar](50) NULL
    ) ON [PRIMARY]
    --INSERT DATA
    INSERT INTO Table_Dept (DeptId, DeptCode, DeptName)
    VALUES (1, 'HO', N'Head Office'),
    (2, 'BO', N'Branch Office'),
    (3, 'RO', N'Reginal Office'),
    (4, 'SO', N'Sub Division Office')
    INSERT INTO Table_Header
    (Header_Id, UserName)
    VALUES (1, N'Ravi'), (2, N'Gopal'), (3, N'Deepa')
    INSERT INTO Table_Detail
    (Header_ID, Name, DescValue)
    VALUES (1, N'ListNumber', N'1005'),
    (1, N'PhaseCode', N'AA'),
    (1, N'DeptCode', 'BO,RO'),
    (1, N'City', 'Bangalore'),
    (2, N'ListNumber', N'1006'),
    (2, N'PhaseCode', N'AB'),
    (2, N'DeptCode', 'SO,RO'),
    (2, N'City', 'Delhi'),
    (3, N'ListNumber', N'1007'),
    (3, N'PhaseCode', N'AA'),
    (3, N'DeptCode', 'HO'),
    (3, N'City', 'Mumbai')
    --EXPECTED RESULT
    HeaderId
    ListNumber
    PhaseCode
    DeptName
    City
    User
    1
    1005
    AA
    Branch Office,   Reginal Office
    Bangalore
    Ravi
    2
    1006
    AB
    Sub Division   Office,Reginal Office
    Delhi
    Gopal
    3
    1007
    AA
    HO
    Mumbai
    Deepa
    ShanmugaRaj

    see below code
    SELECT *,
    STUFF((SELECT ',' + DeptName
    FROM Table_Dept
    WHERE ',' + t.DeptCode + ',' LIKE '%,' + DeptCode + ',%'
    FOR XML PATH('')),1,1,'') AS DeptName
    FROM
    SELECT h.Header_ID,
    td.ListNumber,
    td.PhaseCode,
    td.DeptCode,
    td.City
    FROM Table_header h
    INNER JOIN (SELECT Header_ID,
    MAX(CASE WHEN Name = 'ListNumber' THEN DescValue END) AS ListNumber,
    MAX(CASE WHEN Name = 'PhaseCode' THEN DescValue END) AS PhaseCode,
    MAX(CASE WHEN Name = 'DeptCode' THEN DescValue END) AS DeptCode,
    MAX(CASE WHEN Name = 'City' THEN DescValue END) AS City
    FROM Table_Detail
    GROUP BY Header_ID)td
    ON td.Header_ID = h.Header_ID
    )t
    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs
    In case of not having department table...consider the dept code, where the values are now comming from table and
    need result if the data is not displayed from table and they are static..
    use case when 'Bo' then 'Branch Office'
    when 'Ro' then 'Reginal Office'
    when 'So' then 'Sub Division Office'
    when 'Ho' then 'Head Office'
    kindly suggest how to replace my above query
    ShanmugaRaj

  • Trigger delta and extract header and item texts for sales order

    Hi,
    I need to force a delta as well as extract the header and item texts when any (and only) change is made on the sales order texts.
    Nothing else is changed on the order except the header or item texts.
    Please advise how this can be achieved in the user exit of the VA02 transaction. Please suggests suitable FMs that could be explored.
    Thanks
    Shreyas

    Hi,
    I need to force a delta as well as extract the header and item texts when any (and only) change is made on the sales order texts.
    Nothing else is changed on the order except the header or item texts.
    Please advise how this can be achieved in the user exit of the VA02 transaction. Please suggests suitable FMs that could be explored.
    Thanks
    Shreyas

  • Saving an invoice header and details in sql in one stored procedure.

    I would like to create an invoice in visual studio 2008 with a header and x amount of details (every time it's different). I want to be able to bring it all into sql encapsulated in one begin and commit transaction so that if there is an error anywhere
    on the way it can roll back and nothing will be saved to the database. 
    Debra has a question

    I have an article on my web site which includes a sample not too different from your situation. (In the sample data is read from a file, but that has little to do with the database communication.) Since you pass the data through TVPs, you can have the transaction
    in the stored procedure:
    http://www.sommarskog.se/arrays-in-sql-2008.html
    Erland Sommarskog, SQL Server MVP, [email protected]

  • Header and Detail total mismatch

    Hi All,
            I have file to proxy scenario, and i am using XSLT mapping for source to Traget mapping,
    Here, I add all amounts in details and compare it to Header amount, issue is that although the totals are matching i am still getting total mismatch error.
    The number have 2 decimal places.
    This is the code that i am using:
    <xsl:if test="format-number(number($vInvoice),'#.00') != format-number(sum(a:MT_PaymentData/RecordSet/RecordLineItem/LineItemAmount),'#.00')">
                                       <xsl:value-of select="string('AmtMisMatch ')"/>
                                  </xsl:if>
    Pls advice,
    XIer

    Hi,
    Did you try to use it in your mapping? I mean import the zip in your Interface Mapping and try to execute it there.And see if you are getting the wrong output still. Even i was getting the wrong output in the XMLSPY for my code. But when i implemented the same code in mapping it worked fine.
    Regards,
    Sanjeev.

  • Need to skip page break between header and Detail sections

    Hello,
    I am combining two reports in one report (one in header section and another report in the body section). when this report is run, there's a page break between these two sections. Is it possible to eliminate it? Ideally I would like the detail section to start as soon as the header section of the report is completed in the same page instead of starting (detail section report) in a new page.
    Any help is highly appreciated. Thanks,
    Sundar

    I'd put them into one section to control the breaks.

  • How to validate date between Header and Detail Block..

    Hi All,
    I was trying to find a way where, suppose I enter 'from date' and 'to date' in the header block.then in detail block all 'from dates' and 'to dates' should be restricted between the dates entered in the header block.
    Thank you

    Or U Can Simply set in the child item lowest / highest Allowed Value
    Invoke Property pallete for child date item and set the following
    lowest Allowed Value :header.from_date (must be prefix with :)
    Highest Allowed Value :header.to_date
    siju.koiply

  • Creating view cluster for a header and detail table

    Hi all,
    I want to create a View cluster for maintaining 2 tables (one is the header table and other is the detail table)
    ....for each line in the header table there can be multiple detail line items...
    If anyone has worked on such requirement...please tell me how should i go about developing it.
    after creation i should be able to maintain the cluster using transaction SM34....
    Thanks ,
    Sushil.

    hi
    refer to following link
    http://help.sap.com/saphelp_nw04/helpdata/en/d0/999246b2aa11d1a5700000e82deaaa/frameset.htm
    http://help.sap.com/saphelp_nw04s/helpdata/en/d0/999246b2aa11d1a5700000e82deaaa/frameset.htm
    Cheers
    Snehi

  • Mapping header and detail fields

    I want to map concatenated 1 header source field and  2 detail source fields into 1 target detail row field. Is it possible? I am getting message mapping error in SXMB_MONI. I changed the DT_Detail_Row.fieldFixedLengths, still getting error. Any suggestions  or ideas how I can map these fields?
    Thanks.

    Hey,
    y cant u use 2 Staandard concat functions
    where u concat ur two source fields using one concat and concat that output with the header source field using another concat fucntion and map that output to target field.
    detail1
                 Concat----
    >
    detail2                            concat----->target
                 Header----
    >
    cheers
    jithesh

  • MRP header and detail tables

    Hello All...
    MDKP table is the header data for the MRP document. Does anyone know
    if there is a table for the details?

    I believe that the MRP item data is stored in a data cluster. The database
    table is MDTC, and the data cluster area is ar. Use the following command to
    import the data from the data cluster:
    Import <structure> from database mdtc(ar) ID <key>.
    The ID key value comes from the field dtnum (Number of the material
    requirements planning table) in table MDKP. For an example, take a look at
    line 56 in the form 'aufbauen_mdoex' in program SAPLM61X.
    Hope this helps.

Maybe you are looking for

  • To add the "unloading point/supplier Node" field to the sales order incompl

    Hi All, Very Urgent treat this has high priority! Regarding the field "unloading point/supplier Node" in the header data of sales order VA01- Tab Shipping. You know if the field "unloading point/supplier Node" is missing, then Ebilling will failed. A

  • Not all my purchase history showing up for redownload

    OK, so I'm enjoying iOS 5 on my iPhone 4 and finally have access to download previous purchases directly from the iTunes app. The thing is, not all my songs or albums are showing up as available to redownload. I took a look at my history through iTun

  • Elements 7.0 worked perfectly for many years then stopped working about 1.5 months ago

    Elements 7.0 worked perfectly for many years then stopped working about 1.5 months ago. I just finished at chat session with Adobe support, but we did not find a solution. At the very end, when I tried to run Elements in the sandbox, I got an error m

  • Report Node Setup

    Hello, I have installed PS HRMS 8.9 and PeopleTools 8.46 on Win NT. I did setup process schedular and able to run processes (SQRs, COBOLs) successfully. But I couldn't able to view output in process monitor. The process are running succes but distrib

  • Backup in Contribute

    Does anyone know if you can do a back up in Contribute or do I need to buy another program to do this. I basically want to back up our website in case of crash. If I need a program, any suggestions on who or what would be appreciated. Thanks, Linda