Query LDAP to XML

I am having trouble using the Query Multiple LDAP to XML component. I have it configured right(?) in the workflow. I am trying to retrieve a couple of attributes about the user who is logged in. For now, I have a text box with an invoke button on my form to simulate the action of getting the logged in user.
In my process, if I hardcode a user in or if I invoke the process via the Components label it runs fine and returns the correct XML. If I try to invoke the web service via my form, I receive an "error attempting to read from file".
I have never queried the LDAP before and I am a little confused. Could anyone offer some help?

I have actually disabled the security for that service. I am thinking the problem is that the LDAP server has some sort of block on web service calls. Could that be the issue? All of my other web services (configured the same exact way) function just fine, and running the query in LiveCycle Workbench works fine. That leads me to believe that something is stopping the WSDL connection.

Similar Messages

  • Output query result in XML format

    folks:
    could anybody provide more information
    about how to generate query result in
    xml format? looks like DBXML is for demo only
    and i have heard that PLSQL XML parser is the way to go; so far i have not found
    a sample yet on how to actually
    do the XML generation; if you know more
    about it, please let me know; thanks in
    advance.
    Bill

    Here are some sample apps that might interest you:
    [list]
    [*][url [URL=http://technet.oracle.com/tech/xml/xsql_servlet/index2.htm?Code&files/ffhome.html]The]http://technet.oracle.com/tech/xml/xsql_servlet/index2.htm?Code&files/ffhome.html]The XML Flight Finder
    [*][url [URL=http://technet.oracle.com/sample_code/tech/xml/xmlb2b/doc/xb2bhome.html]B2B]http://technet.oracle.com/sample_code/tech/xml/xmlb2b/doc/xb2bhome.html]B2B with XML
    [list]
    Enjoy,
    -rh

  • How to query from the xml table a single, specified element.

    I'm quite new in Xml Db. Pleas, can anybody tell me how to query from the xml table below a single element (i.e. the element 'rapportoparentela = NIPOTE' related to the element 'codicefiscale = CRRVNC76R52G337R', or the element 'rapportoparentela = FIGLIO' related to the element 'codicefiscale = CRRRNT51L23G337Q')?
    - <dati xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <codiceinterno />
    <codicefiscaleassistito>CRRMNL81R31G337H</codicefiscaleassistito>
    - <famigliare>
    <codicefiscale>CRRVNC76R52G337R</codicefiscale>
    <rapportoparentela>NIPOTE</rapportoparentela>
    </famigliare>
    - <famigliare>
    <codicefiscale>CRRRNT51L23G337Q</codicefiscale>
    <rapportoparentela>FIGLIO</rapportoparentela>
    </famigliare>
    - <famigliare>
    <codicefiscale>CBRPRN15S65E080W</codicefiscale>
    <rapportoparentela>I.S.</rapportoparentela>
    </famigliare>
    - <famigliare>
    <codicefiscale>CRRMNL81R31G337H</codicefiscale>
    <rapportoparentela>NIPOTE</rapportoparentela>
    </famigliare>
    - <famigliare>
    <codicefiscale>BCCCML54C50I845G</codicefiscale>
    <rapportoparentela>NUORA</rapportoparentela>
    </famigliare>
    </dati>
    Using SELECT extractValue(value(t),'/rapportoparentela') into result FROM NF_XMLT X,
    TABLE ( xmlsequence (extract(value(X),'/dati/famigliare/rapportoparentela'))) t
    I get all the elements 'rapportoparentela' and I want to get only one specified.
    Regards.
    Piero

    Piero,
    you can add the condition "CRRVNC76R52G337R" to your xpath-expression like:
    SELECT extractValue(value(t),'/rapportoparentela')
    FROM NF_XMLT x
    ,TABLE ( xmlsequence (extract(value(X),'/dati/famigliare[rapportoparentela="CRRVNC76R52G337R"]'))) tto select only those famigliare-elements that have a child-element rapportoparentela with value "CRRVNC76R52G337R".
    When you stored your XML in an XMLType column in the table, i think the following queries are better:
    SELECT extractValue(x.your_XMLType_column,'/dati/famigliare/rapportoparentela')
    FROM NF_XMLT x
    WHERE extractValue(x.your_XMLType_column,'/dati/famigliare/codicefiscale')
    = 'CRRVNC76R52G337R'or
    SELECT extractValue(x.your_XMLType_column,'/dati/famigliare/rapportoparentela')
    FROM NF_XMLT x
    WHERE existsNode(x.your_XMLType_column,'/dati/famigliare[codicefiscale="CRRVNC76R52G337R"]')
    != 0

  • Querying LDAP based on a timestamp

    How do I query ldap server for entries that are modified after a particular interval. The >= <= usage in filter expression is giving a syntax error. Should I use extensible matching rules ?
    Thanks,
    Ravi

    Yes but you modifytimestamp must be indexed and it is not the case by default in oracle.........
    You must run a unix shell script to recreate index.
    Fred

  • How to send SQL query results to XML ?

    Hey Guys, I am querying a DB with huge amount of traffic. A user select a particular lot and then details of the lot will be displayed in the following page. My concern here is that it takes really LONG to retrieve back the results coz it has to requiry in the following JSP page.
    I was told to use XML to retrieve the dataset and store it. Hence, in the following query it will re-query only from the recordsets in the XML file (...Logically, should be faster rite ? ). Hence, how do parse my recordsets retrieved from the SQL query to an XML file ?
    Any sort of suggestion , help, reference would be deeply appreciated ..Thanks !

    <HTML>
    <BODY>
    <H1>Manufacturing Summary beta </H1><BR>
    <%@ page import="java.sql.*" %>
    <%@ page import="java.lang.*" %>
    <%@ page import="java.text.*" %>
    <jsp:include page="/index.html" flush="true"/>
    <P><B>Returned result<B><BR>
    <B>Query String :</B><%=request.getParameter("date") %>
    <TABLE BORDER=1 cellpadding=0 cellspacing=0>
    <%!
    static double roundDouble(double toBeRounded, int fractionDigits)
    NumberFormat format = NumberFormat.getInstance();
    format.setMaximumFractionDigits(fractionDigits);
    String tempDouble = format.format(toBeRounded);
    return Double.parseDouble(tempDouble);
    %>
    <%
    DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
    Connection conn = DriverManager.getConnection("jdbc:oracle:thin:@klmomnidb:1521:
    OMNIDB","omni","omni");
    Statement stmt = null;
    ResultSet rset = null;
    String S_date = new String();
    String temp = new String();
    String lot_id = new String();
    String result = new String();
    String SQL_String = new String();
    double yield;
    int bad_cnt;
    S_date = request.getParameter("date");
    lot_id = request.getParameter("lot_id");
    temp = request.getParameter("TST_TEMP");
    SQL_String = "SELECT LOT_ID, FLOW_ID, TST_TEMP, MODE_COD, RTST_COD, PART_CNT, GO
    OD_CNT, OPER_NAM, JOB_REV, PROC_ID, START_T, FACIL_ID, TSTR_TYP, NODE_NAM FROM L
    OT where START_T > TO_DATE('"+ S_date + "','MM/DD/YYYY') AND TST_TEMP <='" + tem
    p+"' order by START_T";
    out.println(SQL_String);
    stmt = conn.createStatement();
    rset = stmt.executeQuery (SQL_String);
    out.println("<TR>");
    out.println("<TD> Select Lot(s)</TD>");
    out.println("<TD>Flow </TD>");
    out.println("<TD>Temp </TD>");
    out.println("<TD>Test Mode </TD>");
    out.println("<TD>Retest</TD>");
    out.println("<TD>Total </TD>");
    out.println("<TD>Good</TD>");
    out.println("<TD>Bad</TD>");
    out.println("<TD>Yield </TD>");
    out.println("<TD>UserID</TD>");
    out.println("<TD>Program</TD>");
    out.println("<TD>Mask</TD>");
    out.println("<TD>Start Time </TD>");
    out.println("<TD>Loc </TD>");
    out.println("<TD>Tester</TD>");
    out.println("<TD>System </TD>");
    out.println("</TR>");
    if (! rset.next()) {
    result ="No records found matching seach criteria.";
    while (rset.next()) {
    bad_cnt = Integer.parseInt(rset.getString(6)) - Integer.parseInt(rset.getString(
    7));
    yield = (Double.parseDouble(rset.getString(7)) / Double.parseDouble(rset.getStri
    ng(6))) * 100;
    result= "<TR>";
    result = result + "<TD><a href=coolpage.jsp?LOT_ID=" + rset.getString(1)+ ">" +
    rset.getString(1) + "</A></TD>";
    result = result + "<TD>" + rset.getString(2) + "</TD>";
    result = result + "<TD>" + rset.getString(3) + "</TD>";
    result = result + "<TD>" + rset.getString(4) + "</TD>";
    result = result + "<TD>" + rset.getString(5) + "</TD>";
    result = result + "<TD>" + rset.getString(6) + "</TD>";
    result = result + "<TD>" + rset.getString(7) + "</TD>";
    result = result + "<TD>" + bad_cnt + "</TD>";
    result = result + "<TD>" + roundDouble(yield,2) + "% </TD>";
    result = result + "<TD>" + rset.getString(8) + "</TD>";
    result = result + "<TD>" + rset.getString(9) + "</TD>";
    result = result + "<TD>" + rset.getString(10) + "</TD>";
    result = result + "<TD>" + rset.getString(11) + "</TD>";
    result = result + "<TD>" + rset.getString(12) + "</TD>";
    result = result + "<TD>" + rset.getString(13) + "</TD>";
    result = result + "<TD>" + rset.getString(14) + "</TD>";
    result = result + "</TR>"; %>
    <%=result%>
    <% }
    rset.close();
    stmt.close();
    conn.close();
    %>
    <%=result%>
    </TABLE>
    </BODY>
    </HTML>

  • Sql query generator from xml data

    Hi,
    I am looking for an open source tool in java which would generate the sql query with an xml configuration file as input. The xml configuration file schema would be defined by the tool and and would provide placeholders for giving the various information required to build the sql query.
    Are there any available?
    Please let me know.
    Anshuk

    hi All,
    I tried below . but still no luck .
    CREATE OR REPLACE FUNCTION get_audit_trail_log(cikey IN INTEGER) RETURN blob IS
    CURSOR c_log(l_cikey INTEGER) IS
    SELECT *
    FROM PROD_SOAINFRA.audit_details atr
    WHERE cikey = l_cikey
    ORDER BY count_id;
    bl BLOB;
    BEGIN
    dbms_lob.createtemporary (bl, TRUE);
    FOR r_log IN c_log(cikey)
    LOOP
    dbms_lob.append (bl,r_log.log);
    END LOOP;
    RETURN(bl);
    END;
    =======================================
    SELECT UTL_RAW.CAST_TO_VARCHAR2(UTL_COMPRESS.LZ_UNCOMPRESS(get_audit_trail_log(ci.cikey)))
    FROM PROD_SOAINFRA.audit_details ci
    WHERE cikey = 848063749
    =======================================
    Error:
    =====================
    ORA-22835: Buffer too small for CLOB to CHAR or BLOB to RAW conversion (actual: 20958, maximum: 2000)
    22835. 00000 - "Buffer too small for CLOB to CHAR or BLOB to RAW conversion (actual: %s, maximum: %s)"
    *Cause:    An attempt was made to convert CLOB to CHAR or BLOB to RAW, where
    the LOB size was bigger than the buffer limit for CHAR and RAW
    types.
    Note that widths are reported in characters if character length
    semantics are in effect for the column, otherwise widths are
    reported in bytes.
    *Action:   Do one of the following
    1. Make the LOB smaller before performing the conversion,
    for example, by using SUBSTR on CLOB
    2. Use DBMS_LOB.SUBSTR to convert CLOB to CHAR or BLOB to RAW.

  • Using  Query Multiple to XML

    Hi,
    I am trying to use the service Query Multiple to XML which Queries the database using a SQL statement and returns the result set as XML data.
    I configure and test (using test functionality in this service to see what is gonig on) this service in my workflow. As the result of this test, I saw that this wuery returns a piece of data in xml format like this :
            Özlem Aksel
            Cihan Aydın
            Fatih Büyüktaş
            Melik Akyıldız
            Aydın Türkdoğan
    In Livecycle es samples, there is a sample about multiple query to xml,
    but this sample just show that this service returns XML element. But, does not show, how to use it in forms.
    My aim is, populating a dropdown list in my form, with the data returned by this query. Can anyone tell me how can use this data to populate my dropdown list?
    Thanks in advance
    Best regards
    Cihan Aydın

    Hi, <br /><br />I found a solution for my problem.<br />I try to explain it below :<br /><br />In order to get user names and fill them to a combo,I use a simple form which consist of only a combo of user names with the following <br />xml schema :<br /><br /><?xml version="1.0" encoding="UTF-8"?><br /><xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"><br />    <xsd:annotation><br />        <xsd:documentation xml:lang="en"><br />           MultipleSql deneme<br />        </xsd:documentation><br />    </xsd:annotation><br />    <xsd:element name="UserListApp" type="userlistFormType"/><br />   <br />    <xsd:complexType name="userlistFormType"><br />        <xsd:sequence><br />            <xsd:element name="userList"    type="userlistType"/><br />            <xsd:element name="tempdata"    type="xsd:string"  /><br />           </xsd:sequence><br />    </xsd:complexType><br />    <br />    <xsd:complexType name="userlistType" ><br />        <xsd:sequence><br />            <xsd:element name="users"    type="user"  minOccurs="1" maxOccurs="unbounded" /><br />        </xsd:sequence><br />    </xsd:complexType><br />   <br />    <br />    <xsd:complexType name="user" ><br />        <xsd:sequence><br />            <xsd:element name="name"    type="xsd:string"  /><br />        </xsd:sequence><br />    </xsd:complexType><br /></xsd:schema><br /><br />Then, in process design, I put an query to xml service with the following configuration :<br /><br />SQL stalement :<br />SELECT commonname from  edcprincipalentity where organization=?<br /><br />XML information :<br /><br />root Element name : userList<br />repeating element names : users<br /><br />XML output :<br /><br />define a process variable of XML type (im my ex : xml_output)<br />which returns :<br /><br /><userList><br />    <users><br />        <name type="VARCHAR">Fatih Büyükta&#351;</name><br />    </users><br />    <users><br />        <name type="VARCHAR">Ayd&#305;n Türkdo&#287;an</name><br />    </users><br />    <users><br />        <name type="VARCHAR">Özlem Aksel</name><br />    </users><br />      <users><br />        <name type="VARCHAR">Cihan Ayd&#305;n</name><br />    </users><br /></userList><br /><br />Then using a set value service, put this piesce of xml to  form data<br /><br />/process_data/<FORM VARIBLE NAME>/object/data/xdp/datasets/data/UserListApp<br />=<br />/process_data/xml_output<br /><br />Then, in form,<br /><br />add this script to combo box's initialize event :<br /><br />var oUsersNode = xfa.data.UserListApp.userList;<br />var oUsersNodeList = oUsersNode.resolveNodes("users[*].name");<br /><br />for (var i = 0; i < oUsersNodeList.length; i++)<br />{<br />    this.addItem(oUsersNodeList.item(i).value);<br /><br />}<br /><br />If you send your e-mail I can send you the complete example.<br /><br />Best regards<br /><br />Cihan

  • JDBC 'Query Multiple to XML' throwing NullPointerException on LC Server

    Hi all...
    It seems that any attempt to perform a jdbc access from a deployed LCA (my process at this point only contains the JDBC 'query multiple to xml' operation) results in the following exception on the LC server (see below). The query and xml generation all seem to work ok from the Workbench. I can mail the lca upon request. Thanks.
    [4/28/08 17:10:15:557 EDT] 00000059 SystemOut O [Flex] [ERROR] Root cause: java.lang.NullPointerException
    at com.adobe.idp.dsc.jdbc.helper.SqlHelper.executeQuery(SqlHelper.java:85)
    at com.adobe.idp.dsc.jdbc.JDBCService.queryMultipleToXml(JDBCService.java:391)
    at sun.reflect.GeneratedMethodAccessor1517.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:585)
    at com.adobe.idp.dsc.component.impl.DefaultPOJOInvokerImpl.invoke(DefaultPOJOInvokerImpl.jav a:181)
    at com.adobe.idp.dsc.interceptor.impl.InvocationInterceptor.intercept(InvocationInterceptor. java:134)
    at com.adobe.idp.dsc.interceptor.impl.RequestInterceptorChainImpl.proceed(RequestInterceptor ChainImpl.java:44)
    at com.adobe.idp.dsc.transaction.interceptor.TransactionInterceptor$1.doInTransaction(Transa ctionInterceptor.java:74)
    at com.adobe.idp.dsc.transaction.impl.ejb.adapter.EjbTransactionCMTAdapterBean.execute(EjbTr ansactionCMTAdapterBean.java:336)
    at com.adobe.idp.dsc.transaction.impl.ejb.adapter.EjbTransactionCMTAdapterBean.doSupports(Ej bTransactionCMTAdapterBean.java:212)
    at com.adobe.idp.dsc.transaction.impl.ejb.adapter.EJSLocalStatelessEjbTransactionCMTAdapter_ caf58c4f.doSupports(Unknown Source)
    at com.adobe.idp.dsc.transaction.impl.ejb.EjbTransactionProvider.execute(EjbTransactionProvi der.java:104)
    at com.adobe.idp.dsc.transaction.interceptor.TransactionInterceptor.intercept(TransactionInt erceptor.java:72)
    at com.adobe.idp.dsc.interceptor.impl.RequestInterceptorChainImpl.proceed(RequestInterceptor ChainImpl.java:44)
    at com.adobe.idp.dsc.interceptor.impl.InvalidStateInterceptor.intercept(InvalidStateIntercep tor.java:37)
    at com.adobe.idp.dsc.interceptor.impl.RequestInterceptorChainImpl.proceed(RequestInterceptor ChainImpl.java:44)
    at com.adobe.idp.dsc.interceptor.impl.AuthorizationInterceptor.intercept(AuthorizationInterc eptor.java:88)
    at com.adobe.idp.dsc.interceptor.impl.RequestInterceptorChainImpl.proceed(RequestInterceptor ChainImpl.java:44)
    at com.adobe.idp.dsc.engine.impl.ServiceEngineImpl.invoke(ServiceEngineImpl.java:113)
    at com.adobe.idp.dsc.routing.Router.routeRequest(Router.java:102)
    at com.adobe.idp.dsc.provider.impl.base.AbstractMessageReceiver.routeMessage(AbstractMessage Receiver.java:88)
    at com.adobe.idp.dsc.provider.impl.vm.VMMessageDispatcher.doSend(VMMessageDispatcher.java:21 0)
    at com.adobe.idp.dsc.provider.impl.base.AbstractMessageDispatcher.send(AbstractMessageDispat cher.java:57)
    at com.adobe.idp.dsc.clientsdk.ServiceClient.invoke(ServiceClient.java:208)
    at com.adobe.idp.taskmanager.dsc.service.TaskManagerServiceImpl.renderForm(TaskManagerServic eImpl.java:3404)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:585)
    at com.adobe.idp.dsc.component.impl.DefaultPOJOInvokerImpl.invoke(DefaultPOJOInvokerImpl.jav a:181)
    at com.adobe.idp.dsc.interceptor.impl.InvocationInterceptor.intercept(InvocationInterceptor. java:134)
    at com.adobe.idp.dsc.interceptor.impl.RequestInterceptorChainImpl.proceed(RequestInterceptor ChainImpl.java:44)
    at com.adobe.idp.dsc.trans

    is your issue solved,if not mail me
    [email protected]

  • Is there any LIKE query equivalent in XML?

    Is there any LIKE query equivalent in XML?
    I would like the display words starts with 'A' in flex list, vice versa. I send A as a input.
    Any ideas?

    Hi,
    I don't know that one - but with slight modification I can filter nodes values also - not onlyl attributes:
    var people:XML = <people>
       <person>
                        <firstName>Peter</firstName>
              </person>
       <person>
                        <firstName>Auguste</firstName>
              </person>
       <person>
                        <firstName>Gregory</firstName>
              </person>
       <person>
                        <firstName>Andy</firstName>
              </person>
    </people>
    (so we have nodes that have values - not attributtes)
    and then e.g.:
    var peopleList:XMLList = people.person.(firstName.charAt(0) == "A");
    trace(peopleList);
    (this is dynamic statement - you could replace "A" with variable reference, etc)
    Edit;
    I've googled interesting article you could read on that subject here:
    http://www.senocular.com/flash/tutorials/as3withflashcs3/?page=4
    hth,
    regards,
    Peter
    Message was edited by: Peter Blazejewicz

  • Querying LDAP Server

    I would like to implement some Java Bean classes to query
    LDAP Server by using JNDI. I already have some sample Java code to query LDAP
    Server by using JNDI.
    How can I use WebLogic Server and EJB or other technology to
    query LDAP Server

    Try the LDAP bean that comes with IP*Works! Java Edition http://www.nsoftware.com/
    "weblogic" <[email protected]> wrote in message news:<3b0c2fbd$[email protected]>...
    I would like to implement some Java Bean classes to query
    LDAP Server by using JNDI. I already have some sample Java code to query LDAP
    Server by using JNDI.
    How can I use WebLogic Server and EJB or other technology to
    query LDAP Server

  • Query : JDev + build.xml

    hi all
    I have created one BPEL project in Jdev with that JDev also
    creates build.xml file for compilation & deployment.
    Now If I deploy my BPEL process using JDev Deployer window (Right click on BPEL Project -> Deploy -> BPEL Process Deployer )
    than It compiles BPEL project first then It runs Ant file - build.xml.Now here the my observation is while running build.xml file It will not run compile task - bpelc command . Yes BPEL project is already
    compiled but how JDev will come to know that it should not compile
    BPEL project again. ???
    And another doubt is which JAR file is used to executed "bpelc" command. And we can compile BPEL project from JDev as well as Developer prompt of SOA server so in both cases where this JAR file will be.???
    /M Patel

    I have actually disabled the security for that service. I am thinking the problem is that the LDAP server has some sort of block on web service calls. Could that be the issue? All of my other web services (configured the same exact way) function just fine, and running the query in LiveCycle Workbench works fine. That leads me to believe that something is stopping the WSDL connection.

  • How can I query data from XML file stored as a CLOB ?

    Hi folks,
    please see below sample of XML file, which is stored in "os_import_docs", column "document" as CLOB.
    I would like to query this XML file using some SQL select.
    How can I query data form below XML?
    <?xml version="1.0" encoding="UTF-8"?>
    <etd>
      <header>
        <AR>000000000</AR>
        <AW>0</AW>
        <CT>S</CT>
        <CU>H</CU>
        <CZ>SS48</CZ>
        <BU>4</BU>
        <CH>0032</CH>
        <CK>2012-11-01</CK>
        <CL>21:18</CL>
        <CW>225</CW>
        <CX>0</CX>
        <CF>SS-CZL18</CF>
        <DV>2</DV>
      </header>
      <account_group id="234">
        <account id="234">
          <invoice id="000742024">
            <da>
              <AR>000742024</AR>
              <AW>0</AW>
              <CT>D</CT>
              <CU>A</CU>
              <CH>0032</CH>
              <BY>31-10-2012</BY>
              <CA>25-10-2012</CA>
              <AB>234</AB>
              <AA>234</AA>
              <BS>88754515</BS>
              <AD>Mike Tyson</AD>
              <AC>Mike Tyson</AC>
              <AZ>CZ6521232465</AZ>
              <AE/>
              <CG>A</CG>
              <AL>A</AL>
              <BZ>.</BZ>
              <AH>Some street</AH>
              <AI/>
              <AF>Some city</AF>
              <AK>Kraj</AK>
              <AG>CZ</AG>
              <AJ>885 21</AJ>
              <CR>21-11-2012</CR>
              <AY>602718709</AY>
              <AV>800184965</AV>
              <AP/>
              <AO/>
              <AQ/>
              <AN/>
            </da>
            <da>
              <AR>000742024</AR>
              <AW>0</AW>
              <CT>D</CT>
              <CU>A</CU>
              <CH>0032</CH>
              <BY>31-10-2012</BY>
              <CA>25-10-2012</CA>
              <AB>234</AB>
              <AA>234</AA>
              <BS>88754515</BS>
              <AD>Mike Tyson</AD>
              <AC>Mike Tyson</AC>
              <AZ>CZ6521232465</AZ>
              <AE/>
              <CG>A</CG>
              <AL>L</AL>
              <BZ>Mike Tyson</BZ>
              <AH>Some street</AH>
              <AI/>
              <AF>Some city</AF>
              <AK>Kraj</AK>
              <AG>CZ</AG>
              <AJ>885 21</AJ>
              <CR>21-11-2012</CR>
              <AY/>
              <AV>800184965</AV>
              <AP/>
              <AO/>
              <AQ/>
              <AN/>
            </da>
            <detaildc CH="0032" AB="234" BS="11888954" BB="32" BA="CZ" AT="" CI="7077329000002340342" AU="" DU="1Z48395" CB="CZK">
              <dc>
                <AW>0</AW>
                <CT>D</CT>
                <CU>C</CU>
                <BY>31-10-2012</BY>
                <CA>25-10-2012</CA>
                <CV>8151</CV>
                <BT>12111</BT>
                <CJ>1</CJ>
                <AM>0</AM>
                <DR>PC</DR>
                <DS/>
                <DO>25-10-2012</DO>
                <DQ>18:42</DQ>
                <CE>1</CE>
                <BH>8151</BH>
                <CY>8151 SHELL MALKOVICE P</CY>
                <DP>049336</DP>
                <DT/>
                <BQ/>
                <BR>500000</BR>
                <CN>30</CN>
                <CM>030</CM>
                <BO>160,00</BO>
                <BF>38,900</BF>
                <BC>6224,00</BC>
                <BI>32,417</BI>
                <CD>B</CD>
                <BG>0,600</BG>
                <BK>31,817</BK>
                <BJ>0,000</BJ>
                <DI>8</DI>
                <BP>20,00%</BP>
                <CC>CZK</CC>
                <BM>5090,67</BM>
                <BN>1018,13</BN>
                <BL>6108,80</BL>
                <BD>5090,67</BD>
                <BE>1018,13</BE>
                <DW>6108,80</DW>
                <CO>Nafta</CO>
              </dc>
            </detaildc>
            <dt>
              <AR>000742024</AR>
              <AW>0</AW>
              <CT>D</CT>
              <CU>T</CU>
              <CH>0032</CH>
              <BY>31-10-2012</BY>
              <CA>25-10-2012</CA>
              <AB>234</AB>
              <AA>234</AA>
              <BS>11888954</BS>
              <BB/>
              <BA>CZ</BA>
              <DG>1</DG>
              <CN>30</CN>
              <CM>030</CM>
              <DF>160,00</DF>
              <DH>litr</DH>
              <DJ>20,00%</DJ>
              <DD>5090,67</DD>
              <DE>1018,13</DE>
              <DC>6108,80</DC>
              <DB>CZK</DB>
              <DA>P</DA>
              <AX/>
              <CQ/>
              <CP/>
            </dt>
            <dt>
              <AR>000742024</AR>
              <AW>0</AW>
              <CT>D</CT>
              <CU>T</CU>
              <CH>0032</CH>
              <BY>31-10-2012</BY>
              <CA>25-10-2012</CA>
              <AB>234</AB>
              <AA>234</AA>
              <BS>11888954</BS>
              <BB/>
              <BA>CZ</BA>
              <DG>2</DG>
              <CN/>
              <CM/>
              <DF>160,00</DF>
              <DH>litr</DH>
              <DJ/>
              <DD>5090,67</DD>
              <DE>1018,13</DE>
              <DC>6108,80</DC>
              <DB>CZK</DB>
              <DA/>
              <AX/>
              <CQ/>
              <CP/>
            </dt>
            <dt>
              <AR>000742024</AR>
              <AW>0</AW>
              <CT>D</CT>
              <CU>T</CU>
              <CH>0032</CH>
              <BY>31-10-2012</BY>
              <CA>25-10-2012</CA>
              <AB>234</AB>
              <AA>234</AA>
              <BS>11888954</BS>
              <BB/>
              <BA>CZ</BA>
              <DG>19</DG>
              <CN/>
              <CM/>
              <DF/>
              <DH/>
              <DJ/>
              <DD>5090,67</DD>
              <DE>1018,13</DE>
              <DC>6108,80</DC>
              <DB>CZK</DB>
              <DA/>
              <AX/>
              <CQ/>
              <CP/>
            </dt>
            <dt>
              <AR>000742024</AR>
              <AW>0</AW>
              <CT>D</CT>
              <CU>T</CU>
              <CH>0032</CH>
              <BY>31-10-2012</BY>
              <CA>25-10-2012</CA>
              <AB>234</AB>
              <AA>234</AA>
              <BS>11888954</BS>
              <BB/>
              <BA>CZ</BA>
              <DG>8</DG>
              <CN/>
              <CM/>
              <DF/>
              <DH/>
              <DJ/>
              <DD>5090,67</DD>
              <DE>1018,13</DE>
              <DC>6108,80</DC>
              <DB>CZK</DB>
              <DA/>
              <AX/>
              <CQ/>
              <CP/>
            </dt>
          </invoice>
        </account>
      </account_group>
      <footer>
        <AR>999999999</AR>
        <AW>0</AW>
        <CT>S</CT>
        <CU>T</CU>
        <CZ>SS48</CZ>
        <BU>4</BU>
        <CH>0032</CH>
        <CK>2012-11-01</CK>
        <CL>23:04</CL>
        <CW>225</CW>
        <BX>1</BX>
        <CS>7</CS>
        <BW>0000000000000610880</BW>
      </footer>
    </etd>sample - not working:
        select  x.*
        from os_import_docs d
             ,XMLTABLE('/etd/header'
                        PASSING httpuritype(d.document).getXML()
                        COLUMNS
                           response_status varchar2(50) PATH 'AR'
                        )  x
       where d.object_id = 2587058
         and rownum = 1; 
    ORA-22835: Buffer too small for CLOB to CHAR or BLOB to RAW conversion (actual: 6196, maximum: 4000)Many thanks,
    Tomas

    Hello,
    many thanks for the reply. Your examples are very usefull for me.
    To answer your questions.
    An XML structure:
    /etd
        /header - repeat in each row in output
        /account_group/account
            /invoice
                /da - repeat for each details under "selected "invoice
                /detaildc/dc - the lowest level 
                /detaildn/dn - the lowest level 
                /dt - repeat for each details under "selected "invoice
        /footer - repeat in each row in outputI would like to to have a 1 row for each "record" in /detaildc section and include related nodes at higher levels.
    Please see below XML file, which is simplified file of example in first post, but includes a complete xml structure which needs to be queried in db.
    <?xml version="1.0" encoding="UTF-8"?>
    <etd>
      <header>
        <AR>000000000</AR>
        <CK>2012-10-31</CK>
        <CF>SS-CZL19</CF>
      </header>
      <account_group id="234">
        <account id="234">
          <invoice id="EI08P4000">
            <da>
              <AR>EI08P4000</AR>
              <AD>Mickey Mouse</AD>
            </da>
            <detaildc DU="1Z56655" CB="EUR">
              <dc>
                <DO>16-10-2012</DO>
                <CY>ASFINAG POST_MAUT</CY>
                <BM>1940,60</BM>
                <CO>Dalnicni znamka</CO>
              </dc>
            </detaildc>
            <detaildc DU="2Z55050" CB="EUR">
              <dc>
                <DO>17-10-2012</DO>
                <CY>ASFINAG POST_MAUT</CY>
                <BM>1328,10</BM>
                <CO>Dalnicni znamka</CO>
              </dc>
            </detaildc>
            <detaildc DU="2Z90001" CB="EUR">
              <dc>
                <DO>27-10-2012</DO>
                <CY>ASFINAG POST_MAUT</CY>
                <BM>185,10</BM>
                <CO>Poplatek</CO>
              </dc>
            </detaildc>
            <dt>
              <AR>EI08P4000</AR>
              <DG>8</DG>
            </dt>
          </invoice>
        </account>
        <account id="234">
          <invoice id="EI13T7777">
            <da>
              <AR>EI13T7777</AR>
              <AD>Mickey Mouse</AD>
            </da>
            <detaildc DU="1Z48302" CB="EUR">
              <dc>
                <DO>26-10-2012</DO>
                <CY>SANEF 07706 A 07704</CY>
                <BM>232,10</BM>
                <CO>Dalnicni poplatek</CO>
              </dc>
            </detaildc> 
            <detaildc DU="1Z48302" CB="EUR">
              <dc>
                <DO>20-10-2012</DO>
                <CY>TEST A 07704</CY>
                <BM>30,10</BM>
                <CO>Poplatek</CO>
              </dc>
            </detaildc>       
            <dt>
              <AR>EI13T7777</AR>
              <DG>8</DG>         
            </dt>
          </invoice>
        </account>
        <account id="234">
          <invoice id="EI327744">
            <da>
              <AR>EI327744</AR>
              <AD>Mickey Mouse</AD>
            </da>
            <detaildn  CI="707732 00000234" >
              <dn>
                <BY>30-10-2012</BY>
                <BM>8,10</BM>
              </dn>
            </detaildn>
            <detaildn CI="707732 00000234" >
              <dn>
                <BY>30-10-2012</BY>
                <BM>399,50</BM>
              </dn>
            </detaildn>
            <dt>
              <AR>EI327744</AR>
            </dt>
          </invoice>
        </account>
        <account id="234">
          <invoice id="EI349515">
            <da>
              <AR>EI349515</AR>
              <AD>Mickey Mouse</AD>
            </da>
            <detaildc DU="1Z56514" CB="EUR">
              <dc>
                <DO>29-10-2012</DO>
                <CY>ALLAMI AUTOPALYAKEZE</CY>
                <BM>1240,60</BM>
                <CO>Dalnicni znamka</CO>
              </dc>
            </detaildc>
            <detaildc DU="1Z56515" CB="EUR">
              <dc>
                <DO>19-10-2012</DO>
                <CY>ASFINAG POST_MAUT</CY>
                <BM>7428,10</BM>
                <CO>Dalnicni znamka</CO>
              </dc>
            </detaildc>
            <detaildc DU="1Z56515" CB="EUR">
              <dc>
                <DO>12-10-2012</DO>
                <CY>UK</CY>
                <BM>954,10</BM>
                <CO>Poplatek</CO>
              </dc>
            </detaildc>
            <dt>
              <AR>EI349515</AR>
              <DG>8</DG>
            </dt>
          </invoice>
        </account>
      </account_group>
      <footer>
        <CZ>SS47</CZ>
        <BU>4</BU>
        <CH>0032</CH>
        <CK>2012-10-31</CK>
        <CL>01:25</CL>
      </footer>
    </etd>Expected output
    AR     CK     CF             AR4             AD             DU     CB     DO             CY                     BM      CO                AR5             DG     CI             BY               BM6     CZ     BU       CH       CK7    CL
    0     41213     SS-CZL19     EI08P4000     Mickey Mouse     1Z56655     EUR     16-10-2012     ASFINAG POST_MAUT     1940,60     Dalnicni znamka        EI08P4000     8                                    SS47     4     32     41213     01:25
    0     41213     SS-CZL19     EI08P4000     Mickey Mouse     2Z55050     EUR     17-10-2012     ASFINAG POST_MAUT     1328,10     Dalnicni znamka        EI08P4000     8                                    SS47     4     32     41213     01:25
    0     41213     SS-CZL19     EI08P4000     Mickey Mouse     2Z90001     EUR     27-10-2012     ASFINAG POST_MAUT      185,10     Poplatek        EI08P4000     8                                    SS47     4     32     41213     01:25
    0     41213     SS-CZL19     EI13T7777     Mickey Mouse     1Z48302     EUR     26-10-2012     SANEF 07706 A 07704      232,10     Dalnicni poplatek  EI13T7777     8                                    SS47     4     32     41213     01:25
    0     41213     SS-CZL19     EI13T7777     Mickey Mouse     1Z48302     EUR     20-10-2012     TEST A 07704               30,10     Poplatek        EI13T7777     8                                    SS47     4     32     41213     01:25
    0     41213     SS-CZL19     EI327744     Mickey Mouse                                                                      EI327744          707732 00000234     30-10-2012     8,10     SS47     4     32     41213     01:25
    0     41213     SS-CZL19     EI327744     Mickey Mouse                                                                      EI327744          707732 00000234     30-10-2012     399,50     SS47     4     32     41213     01:25
    0     41213     SS-CZL19     EI349515     Mickey Mouse     1Z56514     EUR     29-10-2012     ALLAMI AUTOPALYAKEZE     1240,60     Dalnicni znamka        EI349515     8                                    SS47     4     32     41213     01:25
    0     41213     SS-CZL19     EI349515     Mickey Mouse     1Z56515     EUR     19-10-2012     ASFINAG POST_MAUT     7428,10     Dalnicni znamka        EI349515     8                                    SS47     4     32     41213     01:25
    0     41213     SS-CZL19     EI349515     Mickey Mouse     1Z56515     EUR     12-10-2012     UK                      954,10     Poplatek        EI349515     8                                    SS47     4     32     41213     01:25

  • The problem of query in oracle xml db

    hello everybody!
    I create a table of xmltype,and insert data in it. But I query data ,the problem comes up.
    the xml instance is :
    <?xml version="1.0" encoding="UTF-8"?>
    <!-- File: cambridge.xml -->
    <CityModel xmlns="http://www.opengis.net/examples" xmlns:gml="http://www.opengis.net/gml" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2000/10/XMLSchema-instance" xsi:schemaLocation="http://www.opengis.net/examples city.xsd">
         <gml:name>Cambridge</gml:name>
         <gml:boundedBy>
              <gml:Box srsName="http://www.opengis.net/gml/srs/epsg.xml#4326">
                   <gml:coord>
                        <gml:X>0.0</gml:X>
                        <gml:Y>0.0</gml:Y>
                   </gml:coord>
                   <gml:coord>
                        <gml:X>100.0</gml:X>
                        <gml:Y>100.0</gml:Y>
                   </gml:coord>
              </gml:Box>
         </gml:boundedBy>
         <cityMember>
              <River>
                   <gml:description>The river that runs through Cambridge.</gml:description>
                   <gml:name>Cam</gml:name>
                   <gml:centerLineOf>
                        <gml:LineString srsName="http://www.opengis.net/gml/srs/epsg.xml#4326">
                             <gml:coord>
                                  <gml:X>0</gml:X>
                                  <gml:Y>50</gml:Y>
                             </gml:coord>
                             <gml:coord>
                                  <gml:X>70</gml:X>
                                  <gml:Y>60</gml:Y>
                             </gml:coord>
                             <gml:coord>
                                  <gml:X>100</gml:X>
                                  <gml:Y>50</gml:Y>
                             </gml:coord>
                        </gml:LineString>
                   </gml:centerLineOf>
              </River>
         </cityMember>
         <cityMember>
              <Road>
                   <gml:name>M11</gml:name>
                   <linearGeometry>
                        <gml:LineString srsName="http://www.opengis.net/gml/srs/epsg.xml#4326">
                             <gml:coord>
                                  <gml:X>0</gml:X>
                                  <gml:Y>5.0</gml:Y>
                             </gml:coord>
                             <gml:coord>
                                  <gml:X>20.6</gml:X>
                                  <gml:Y>10.7</gml:Y>
                             </gml:coord>
                             <gml:coord>
                                  <gml:X>80.5</gml:X>
                                  <gml:Y>60.9</gml:Y>
                             </gml:coord>
                        </gml:LineString>
                   </linearGeometry>
                   <classification>motorway</classification>
                   <number>11</number>
              </Road>
         </cityMember>
         <cityMember xlink:type="simple" xlink:title="Trinity Lane" xlink:href="http://www.foo.net/cgi-bin/wfs?FeatureID=C10239" gml:remoteSchema="city.xsd#xpointer(//complexType[@name='RoadType'])"/>
         <!-- a mountain doesn't belong here! Uncomment this cityMember and see
    the parser complain!
    <cityMember>
    <Mountain>
    <gml:description>World's highest mountain is in Nepal!</gml:description>
    <gml:name>Everest</gml:name>
    <elevation>8850</elevation>
    </Mountain>
    </cityMember>
    -->
         <dateCreated>2000-11</dateCreated>
    </CityModel>
    I query it:
    set long 50000
    SELECT extract(value(X),
    '/CityModel/gml:boundedBy/gml:Box/gml:coord')
    FROM city X;
    ERROR:
    ORA-31011: XML 语法分析失败
    ORA-19202: XML 处理
    LPX-00601: Invalid token in: '/CityModel/gml:boundedBy/gml:Box/gml:coord' 时出错
    未选定行
    when query it again:
    set long 50000
    SELECT extract(value(X),
    '/CityModel/boundedBy/Box/coord')
    FROM city X; (it has no namespace)
    EXTRACT(VALUE(X),'/CITYMODEL/BOUNDEDBY/BOX/COORD')
    has no result.
    thank you very much!

    <?xml version="1.0" encoding="UTF-8"?>
    <!-- File: cambridge.xml -->
    <CityModel xmlns="http://www.opengis.net/examples" xmlns:gml="http://www.opengis.net/gml" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2000/10/XMLSchema-instance">
    <gml:name>Cambridge</gml:name>
    <gml:boundedBy>
    <gml:Box srsName="http://www.opengis.net/gml/srs/epsg.xml#4326">
    <gml:coord>
    <gml:X>0.0</gml:X>
    <gml:Y>0.0</gml:Y>
    </gml:coord>
    <gml:coord>
    <gml:X>100.0</gml:X>
    <gml:Y>100.0</gml:Y>
    </gml:coord>
    </gml:Box>
    </gml:boundedBy>
    <cityMember>
    <River>
    <gml:description>The river that runs through Cambridge.</gml:description>
    <gml:name>Cam</gml:name>
    <gml:centerLineOf>
    <gml:LineString srsName="http://www.opengis.net/gml/srs/epsg.xml#4326">
    <gml:coord>
    <gml:X>0</gml:X>
    <gml:Y>50</gml:Y>
    </gml:coord>
    <gml:coord>
    <gml:X>70</gml:X>
    <gml:Y>60</gml:Y>
    </gml:coord>
    <gml:coord>
    <gml:X>100</gml:X>
    <gml:Y>50</gml:Y>
    </gml:coord>
    </gml:LineString>
    </gml:centerLineOf>
    </River>
    </cityMember>
    <cityMember>
    <Road>
    <gml:name>M11</gml:name>
    <linearGeometry>
    <gml:LineString srsName="http://www.opengis.net/gml/srs/epsg.xml#4326">
    <gml:coord>
    <gml:X>0</gml:X>
    <gml:Y>5.0</gml:Y>
    </gml:coord>
    <gml:coord>
    <gml:X>20.6</gml:X>
    <gml:Y>10.7</gml:Y>
    </gml:coord>
    <gml:coord>
    <gml:X>80.5</gml:X>
    <gml:Y>60.9</gml:Y>
    </gml:coord>
    </gml:LineString>
    </linearGeometry>
    <classification>motorway</classification>
    <number>11</number>
    </Road>
    </cityMember>
    <cityMember xlink:type="simple" xlink:title="Trinity Lane" xlink:href="http://www.foo.net/cgi-bin/wfs?FeatureID=C10239" gml:remoteSchema="city.xsd#xpointer(//complexType[@name='RoadType'])"/>
    <!-- a mountain doesn't belong here! Uncomment this cityMember and see
    the parser complain!
    <cityMember>
    <Mountain>
    <gml:description>World's highest mountain is in Nepal!</gml:description>
    <gml:name>Everest</gml:name>
    <elevation>8850</elevation>
    </Mountain>
    </cityMember>
    -->
    <dateCreated>2000-11</dateCreated>
    </CityModel>
    SQL>create table city of xmltype;
    then insert the data into the table
    and query:
    set long 50000
    SELECT extract(value(X),
    '/CityModel/boundedBy/Box/coord')
    FROM city X; (it has no namespace)
    EXTRACT(VALUE(X),'/CITYMODEL/BOUNDEDBY/BOX/COORD')
    and I query it again:
    set long 50000
    SELECT extract(value(X),
    '/CityModel/gml:boundedBy/gml:Box/gml:coord')
    FROM city X;
    ERROR:
    ORA-31011: XML 语法分析失败
    ORA-19202: XML 处理
    LPX-00601: Invalid token in: '/CityModel/gml:boundedBy/gml:Box/gml:coord' 时出错
    未选定行
    ma oracle is 10g
    thank you very much!
    Message was edited by:
    user508129

  • Need help for SQL SELECT query to fetch XML records from Oracle tables having CLOB field

    Hello,
    I have a scenario wherein i need to fetch records from several oracle tables having CLOB fields(which is holding XML) and then merge them logically to form a hierarchy XML. All these tables are related with PK-FK relationship. This XML hierarchy is having 'OP' as top-most root node and ‘DE’ as it’s bottom-most node with One-To-Many relationship. Hence, Each OP can have multiple GM, Each GM can have multiple DM and so on.
    Table structures are mentioned below:
    OP:
    Name                             Null                    Type        
    OP_NBR                    NOT NULL      NUMBER(4)    (Primary Key)
    OP_DESC                                        VARCHAR2(50)
    OP_PAYLOD_XML                           CLOB       
    GM:
    Name                          Null                   Type        
    GM_NBR                  NOT NULL       NUMBER(4)    (Primary Key)
    GM_DESC                                       VARCHAR2(40)
    OP_NBR               NOT NULL          NUMBER(4)    (Foreign Key)
    GM_PAYLOD_XML                          CLOB   
    DM:
    Name                          Null                    Type        
    DM_NBR                  NOT NULL         NUMBER(4)    (Primary Key)
    DM_DESC                                         VARCHAR2(40)
    GM_NBR                  NOT NULL         NUMBER(4)    (Foreign Key)
    DM_PAYLOD_XML                            CLOB       
    DE:
    Name                          Null                    Type        
    DE_NBR                     NOT NULL           NUMBER(4)    (Primary Key)
    DE_DESC                   NOT NULL           VARCHAR2(40)
    DM_NBR                    NOT NULL           NUMBER(4)    (Foreign Key)
    DE_PAYLOD_XML                                CLOB    
    +++++++++++++++++++++++++++++++++++++++++++++++++++++
    SELECT
    j.op_nbr||'||'||j.op_desc||'||'||j.op_paylod_xml AS op_paylod_xml,
    i.gm_nbr||'||'||i.gm_desc||'||'||i.gm_paylod_xml AS gm_paylod_xml,
    h.dm_nbr||'||'||h.dm_desc||'||'||h.dm_paylod_xml AS dm_paylod_xml,
    g.de_nbr||'||'||g.de_desc||'||'||g.de_paylod_xml AS de_paylod_xml,
    FROM
    DE g, DM h, GM i, OP j
    WHERE
    h.dm_nbr = g.dm_nbr(+) and
    i.gm_nbr = h.gm_nbr(+) and
    j.op_nbr = i.op_nbr(+)
    +++++++++++++++++++++++++++++++++++++++++++++++++++++
    I am using above SQL select statement for fetching the XML records and this gives me all related xmls for each entity in a single record(OP, GM, DM. DE). Output of this SQL query is as below:
    Current O/P:
    <resultSet>
         <Record1>
              <OP_PAYLOD_XML1>
              <GM_PAYLOD_XML1>
              <DM_PAYLOD_XML1>
              <DE_PAYLOD_XML1>
         </Record1>
         <Record2>
              <OP_PAYLOD_XML2>
              <GM_PAYLOD_XML2>
              <DM_PAYLOD_XML2>
              <DE_PAYLOD_XML2>
         </Record2>
         <RecordN>
              <OP_PAYLOD_XMLN>
              <GM_PAYLOD_XMLN>
              <DM_PAYLOD_XMLN>
              <DE_PAYLOD_XMLN>
         </RecordN>
    </resultSet>
    Now i want to change my SQL query so that i get following output structure:
    <resultSet>
         <Record>
              <OP_PAYLOD_XML1>
              <GM_PAYLOD_XML1>
              <GM_PAYLOD_XML2> .......
              <GM_PAYLOD_XMLN>
              <DM_PAYLOD_XML1>
              <DM_PAYLOD_XML2> .......
              <DM_PAYLOD_XMLN>
              <DE_PAYLOD_XML1>
              <DE_PAYLOD_XML2> .......
              <DE_PAYLOD_XMLN>
         </Record>
         <Record>
              <OP_PAYLOD_XML2>
              <GM_PAYLOD_XML1'>
              <GM_PAYLOD_XML2'> .......
              <GM_PAYLOD_XMLN'>
              <DM_PAYLOD_XML1'>
              <DM_PAYLOD_XML2'> .......
              <DM_PAYLOD_XMLN'>
              <DE_PAYLOD_XML1'>
              <DE_PAYLOD_XML2'> .......
              <DE_PAYLOD_XMLN'>
         </Record>
    <resultSet>
    Appreciate your help in this regard!

    Hi,
    A few questions :
    How's your first query supposed to give you an XML output like you show ?
    Is there something you're not telling us?
    What's the content of, for example, <OP_PAYLOD_XML1> ?
    I don't think it's a good idea to embed the node level in the tag name, it would make much sense to expose that as an attribute.
    What's the db version BTW?

  • Need the output of a query in given XML format

    I have a table as
    create table t_cases (case_id number, pros_seq number, case_lname varchar2(100),
    day_phone number, night_phone number, intl_phone number);
    where case_id and pros_seq is the compound primary key.
    The insert script to insert the data in the table is
    insert into t_cases values(1, 1, 'test', 12, 23, 34);
    insert into t_cases values(1, 2, 'test', 56, 67, 78);
    commit;
    Now from this table I need to query and fetch the data in the following xml format.
    &lt;case REPEATINGTYPE="PageList"&gt;
    &lt;rowdata REPEATINGINDEX="1"&gt;
    &lt;caseid&gt;1&lt;/caseid&gt;
    &lt;prosseq&gt;1&lt;/prosseq&gt;
    &lt;PhoneNumbers REPEATINGTYPE="PageList"&gt;
    &lt;rowdata REPEATINGINDEX="1"&gt;
    &lt;CountryCode&gt;12&lt;/CountryCode&gt;
    &lt;Type&gt;Day&lt;/Type&gt;
    &lt;/rowdata&gt;
    &lt;rowdata REPEATINGINDEX="2"&gt;
    &lt;CountryCode&gt;23&lt;/CountryCode&gt;
    &lt;Type&gt;Night&lt;/Type&gt;
    &lt;/rowdata&gt;
    &lt;rowdata REPEATINGINDEX="3"&gt;
    &lt;CountryCode&gt;34&lt;/CountryCode&gt;
    &lt;Type&gt;International&lt;/Type&gt;
    &lt;/rowdata&gt;
    &lt;/PhoneNumbers&gt;
    &lt;/rowdata&gt;
    &lt;rowdata REPEATINGINDEX="2"&gt;
    &lt;caseid&gt;1&lt;/caseid&gt;
    &lt;prosseq&gt;2&lt;/prosseq&gt;
    &lt;PhoneNumbers REPEATINGTYPE="PageList"&gt;
    &lt;rowdata REPEATINGINDEX="1"&gt;
    &lt;CountryCode&gt;56&lt;/CountryCode&gt;
    &lt;Type&gt;Day&lt;/Type&gt;
    &lt;/rowdata&gt;
    &lt;rowdata REPEATINGINDEX="2"&gt;
    &lt;CountryCode&gt;67&lt;/CountryCode&gt;
    &lt;Type&gt;Night&lt;/Type&gt;
    &lt;/rowdata&gt;
    &lt;rowdata REPEATINGINDEX="3"&gt;
    &lt;CountryCode&gt;78&lt;/CountryCode&gt;
    &lt;Type&gt;International&lt;/Type&gt;
    &lt;/rowdata&gt;
    &lt;/PhoneNumbers&gt;
    &lt;/rowdata&gt;
    &lt;/case&gt;
    Please let me know how to do this.

    Like this...
    select XMLELEMENT( "case", XMLATTRIBUTES ('PageList' as "RepeatingType")
                     ,xmlagg(
                              xmlelement("rowdata", xmlattributes(pros_seq as "RepeatingIndex")
                                        ,xmlelement("caseid", case_id)
                                        ,xmlelement("prosseq", pros_seq)
                                        ,xmlelement("PhoneNumbers", xmlattributes('PageList' as "RepeatingType")
                                                   ,xmlelement("rowdata", xmlattributes(1 as "RepeatingIndex")
                                                              ,xmlelement("CountryCode", day_phone)
                                                              ,xmlelement("Type", 'Day')
                                                   ,xmlelement("rowdata", xmlattributes(2 as "RepeatingIndex")
                                                              ,xmlelement("CountryCode", night_phone)
                                                              ,xmlelement("Type", 'Night')
                                                   ,xmlelement("rowdata", xmlattributes(3 as "RepeatingIndex")
                                                              ,xmlelement("CountryCode", intl_phone)
                                                              ,xmlelement("Type", 'International')
            as x
    from t_cases

Maybe you are looking for