Oracle SQL - Extracting clob value from XML with repeating nodes

Hi All,
I am attempting to run SQL on a table (called test_xml with a column xml_data [data type xmltype]). The column contains xml with repeating nodes (description). The following statement runs successfully when the node contains data of a non clob size:
SELECT
extractvalue (Value (wl), '*/description')
FROM test_xml
, TABLE (xmlsequence (extract (xml_data, '*/record'))) wl
but fails when description node contains a lot of data:
ORA-01706: user function result value was too large
I amended my query:
SELECT
extractvalue(Value (wl), '*/description').getClobVal()
FROM test_xml
, TABLE (xmlsequence (extract (xml_data, '*/record'))) wl
but this fails with:
ORA-22806: not an object or REF
Thanks in Advance

Hi Greg,
11.2.0.2.0 (Although I will need to do this on my work instance also which is 10.2.0.4)That's gonna be a problem...
Direct CLOB projection is supported starting with 11.2.0.2, using XMLTable or XMLCast/XQuery functions (extractvalue, extract, xmlsequence are deprecated now) :
SELECT x.*
FROM test_xml t
   , XMLTable(
       '/*/record'
       passing t.xml_data
       columns
         description  clob path 'description'
     ) x
;On prior versions, implicit conversions will occur to VARCHAR2 datatype, hence the limitation observed.
AFAIK you have two options on 10.2.0.4 :
1) Using Object-Relational storage, with the xdb:SQLType="CLOB" annotation.
2) Using the following trick :
SELECT dbms_xmlgen.convert(x.description.getClobVal(), 1) as description
FROM test_xml t
   , XMLTable(
       '/*/record'
       passing t.xml_data
       columns
         description  xmltype path 'description/text()'
     ) x
;

Similar Messages

  • Extracting Tag Value from XML returned when a web service via PL/SQL

    All,
    Good afternoon.
    I have a PL/SQL that called a web service. The code is as below:
    create or replace procedure soap3 as
    soap_request varchar2(30000);
    soap_respond varchar2(30000);
    http_req utl_http.req;
    http_resp utl_http.resp;
    resp XMLType;
    i integer;
    bra number := 205;
    cus number := 134988;
    cur number := 1;
    led number := 0;
    sub number := 0;
    chq number := 1;
    n number;
    v_raw RAW(32767);
    buff RAW(32767);
    http_res UTL_HTTP.resp;
    blob_length INTEGER;
    chunk_size BINARY_INTEGER := 32767;
    blob_position INTEGER := 1;
    out_file UTL_FILE.FILE_TYPE;
    name VARCHAR2(256);
    value VARCHAR2(1024);
    v_buffer RAW(32767);
    begin
    soap_request := '<?xml version="1.0" encoding="utf-8"?>
    <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
    <soap:Body>
    <Validate_Mandate xmlns="http://tempuri.org/Clearing_Workflow/Service1">
    <Bra_code>205</Bra_code>
    <Cus_num>134988</Cus_num>
    <Cur_code>0</Cur_code>
    <Led_code>0</Led_code>
    <sub_acct_Code>0</sub_acct_Code>
    </Validate_Mandate>
    </soap:Body>
    </soap:Envelope>';
    --DBMS_LOB.CREATETEMPORARY(buff,true);
    http_req := utl_http.begin_request('http://10.99.0.13/clearinginwards/InwardCheques.asmx',
    'POST',
    'HTTP/1.1');
    utl_http.set_header(http_req, 'Content-Type', 'text/xml'); -- since we are dealing with plain text in XML documents
    utl_http.set_header(http_req, 'Content-Length', length(soap_request));
    utl_http.set_header(http_req,
    'SOAPAction',
    'http://tempuri.org/Clearing_Workflow/Service1/Validate_Mandate'); -- required to specify this is a SOAP communication
    utl_http.write_text(http_req, soap_request);
    http_resp := utl_http.get_response(http_req);
    dbms_output.put_line('HTTP response status code: ' || http_resp.status_code);
    dbms_output.put_line('HTTP response reason phrase: ' || http_resp.reason_phrase);
    UTL_HTTP.read_raw(http_resp, buff, 32767);
    end;
    The response gotten from the web service is as below :
    open=F, temp=T, length=13256, chunksize=8132, data=3C3F786D6C2076657273696F6E3D22312E302220656E636F64696E673D227574662D38223F3E3C736F61703A456E76656C6F706520786D6C6E733A736F61703D22687474703A2F2F736368656D61732E786D6C736F61702E6F72672F736F61702F656E76656C6F70652F2220786D6C6E733A7873693D22687474703A2F2F7777772E77332E6F72672F323030312F584D4C536368656D612D696E7374616E63652220786D6C6E733A7873643D22687474703A2F2F7777772E77332E6F72672F323030312F584D4C536368656D61223E3C736F61703A426F64793E3C56616C69646174655F4D616E64617465526573706F6E736520786D6C6E733D2268747470
    I do not understand what this output actually means as what the webservice returns is meant tio be a XML with a signature tag that contain an image of customers signature.
    Please I need help.

    Thanks for the responses thus far , but I think i need to properly define my problem so will be able to help me better.
    I have a webservice with the definition below :
    POST /NigMailService/nigmailservice.asmx HTTP/1.1
    Host: 10.2.15.157
    Content-Type: text/xml; charset=utf-8
    Content-Length: length
    SOAPAction: "http://tempuri.org/GetImageDataTable_HT"
    <?xml version="1.0" encoding="utf-8"?>
    <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
    <soap:Body>
    <GetImageDataTable_HT xmlns="http://tempuri.org/">
    <BranchCode>int</BranchCode>
    <CustomerNumber>int</CustomerNumber>
    <CurrencyCode>int</CurrencyCode>
    <LedgerCode>int</LedgerCode>
    <SubAccountCode>int</SubAccountCode>
    <ChequeNumber>int</ChequeNumber>
    <ClientCode>string</ClientCode>
    <wantedImageTypes>int</wantedImageTypes>
    <wantedImageSize_InPercent>int</wantedImageSize_InPercent>
    </GetImageDataTable_HT>
    </soap:Body>
    </soap:Envelope>
    and sample response :
    HTTP/1.1 200 OK
    Content-Type: text/xml; charset=utf-8
    Content-Length: length
    <?xml version="1.0" encoding="utf-8"?>
    <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
    <soap:Body>
    <GetImageDataTable_HTResponse xmlns="http://tempuri.org/">
    <GetImageDataTable_HTResult>xmlxml</GetImageDataTable_HTResult>
    </GetImageDataTable_HTResponse>
    </soap:Body>
    </soap:Envelope>
    My aim is to write a PL/SQL that will call the webservice and recieve the response which is definately a XML with an image that is meant to be written to a file in PL/SQL.
    Please how can i achieve this ?

  • Extracting value from XML tags in Java

    Hi all,
    I need to extract the value from a string (XML Format). Eg. <Name>Ray</Name> and displaying Name: Ray
    The string value is like any other String class object except that it is format with XML tags. I have quite a few examples that shows how a value can be read from a .xml file but none that describe how to get a value from a String object.
    Thanks in advance.

                         DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
         DocumentBuilder parser = factory.newDocumentBuilder();
         Document document = parser.parse("Your XML Goes here ");

  • Getting a Clob Value from an OUT Parameter

    I am having trouble fetching the CLOB Value(an XML Document) from an Out parameter. I have been
    trying to fetch the value into a String, an OracleClob, etc.. no luck still get either an invalid
    cast or a DBNULL value. Is there an example out there for returning and manipulating CLOBS in either VB.NET or in C#.
    Thanks,
    Scott E. Hunley

    Scott,
    Hopefully, this will help:
    ========================== C# code begin ===========================
    using System;
    using System.Data;
    using Oracle.DataAccess.Client;
    using Oracle.DataAccess.Types;
    namespace Test
    class OutClob
    static OracleCommand cmd;
    static void Execute(string sql)
    try
    cmd.CommandText = sql;
    cmd.ExecuteNonQuery();
    catch (Exception e)
    Console.WriteLine(e.Message);
    static void Main(string[] args)
    // connect
    OracleConnection con = new OracleConnection();
    con.ConnectionString = "user id=scott;password=tiger;data source=ora92;";
    con.Open();
    // instantiate the command object
    cmd = new OracleCommand();
    cmd.Connection = con;
    // drop table
    Execute("drop table foo");
    // create table
    Execute("create table foo (num number, xml clob)");
    // insert a row with xml data in a CLOB column
    Execute("insert into foo values (1, '<foo>bar</foo>')");
    // bind and output parameter for an anonymous PL/SQL block
    OracleParameter p1 = cmd.Parameters.Add("p1", OracleDbType.Clob);
    p1.Direction = ParameterDirection.Output;
    // execute the anonymous PL/SQL block which returns a CLOB as an
    // output parameter of type OracleClob
    Execute("begin select xml into :1 from foo where num = 1; end;");
    // Obtain the clob with the proper cast
    OracleClob clob = (OracleClob)p1.Value;
    // print out the XML document
    Console.WriteLine(clob.Value);
    ========================== C# code end ===========================
    Output:
    <foo>bar</foo>

  • How to get real value from selectOneChoice with javascript?

    Hi,
    How to get real value from selectOneChoice with javascript? The event.getNewValue() only gets me the index of the selected item, not the value/title.
    JSF page:
    <af:resource type="javascript">
    function parseAddress(event)
    alert("new value: " + event.getNewValue());
    </af:resource>
    <af:selectOneChoice label="Location:" value="" id="soc4">
    <af:clientListener type="valueChange" method="parseAddress" />
    <f:selectItems value="#{Person.locations}" id="si7"/>
    </af:selectOneChoice>
    HTML :
    <option title="225 Broadway, New York, NY-10007" selected="" value="0">225 Broadway (Central Office)</option>
    <option title="90 Mark St., New York, NY-10007" value="1">90 Mark St. (Central Office)</option>
    Thanks a lot.

    Something I was missing ,
    You need to add valuePassThru="true" in your <af:selectOneChoice component. I have personally tested it and got the actual value in alert box. I hope this time you got the real solution. You can also test the following code by your end.
    <?xml version='1.0' encoding='UTF-8'?>
    <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:af="http://xmlns.oracle.com/adf/faces/rich">
    <jsp:directive.page contentType="text/html;charset=UTF-8"/>
    <f:view>
    <af:document id="d1">
    <af:form id="f1">
    <af:panelBox text="PanelBox1" id="pb1">
    <af:selectOneChoice label="Set Log Level" id="soc1"
    value="#{SelectManagedBean.loggerDefault}"
    valuePassThru="true">
    <af:selectItem label="select one" value="First" id="s6"/>
    <af:selectItem label="select two" value="Second" id="s56"/>
    <af:clientListener method="setLogLevel" type="valueChange"/>
    </af:selectOneChoice>
    <af:resource type="javascript">
    function setLogLevel(evt) {
    var selectOneChoice = evt.getSource();
    var logLevel = selectOneChoice.getSubmittedValue();
    // var logLevelObject = AdfLogger.NONE;
    alert("new value is : " + logLevel);
    //alert(evt.getSelection);
    //alert(logLevelObject);
    evt.cancel();
    </af:resource>
    </af:panelBox>
    </af:form>
    </af:document>
    </f:view>
    </jsp:root>

  • How to retrieve value from xml file

    hi all,
    can somebody pls tell me how to retrieve value from xml file using SAXParser.
    I want to retrieve value of only one tag and have to perform some validation with that value.
    it's urgent .
    pls help me out
    thnx in adv.
    ritu

    hi shanu,
    the pbm is solved, now i m able to access XXX no. in action class & i m able to validate it. The only thing which i want to know is it ok to declare static ArrayList as i have done in this code. i mean will it affect the performance or functionality of the system.
    pls have a look at the following code snippet.
    public class XMLValidator {
    static ArrayList strXXX = new ArrayList();
    public void validate(){
    factory.setValidating(true);
    parser = factory.newSAXParser();
    //all factory code is here only
    parser.parse(xmlURI, new XMLErrorHandler());     
    public void setXXX(String pstrXXX){          
    strUpn.add(pstrXXX);
    public ArrayList getXXX(){
    return strXXX;
    class XMLErrorHandler extends DefaultHandler {
    String tagName = "";
    String tagValue = "";
    String applicationRefNo = "";
    String XXXValue ="";
    String XXXNo = "";          
    XMLValidator objXmlValidator = new XMLValidator();
    public void startElement(String uri, String name, String qName, Attributes atts) {
    tagName = qName;
    public void characters(char ch[], int start, int length) {
    if ("Reference".equals(tagName)) {
    tagValue = new String(ch, start, length).trim();
    if (tagValue.length() > 0) {
    RefNo = new String(ch, start, length);
    if ("XXX".equals(tagName)) {
    XXXValue = new String(ch, start, length).trim();
    if (XXXValue.length() > 0) {
    XXXNo = new String(ch, start, length);
    public void endElement(String uri, String localName, String qName) throws SAXException {                    
    if(qName.equalsIgnoreCase("XXX")) {     
    objXmlValidator.setXXX(XXXNo);
    thnx & Regards,
    ritu

  • How to Pass values from XML to JSP??? Urgent Please Help me

    Hi guys,
    I am new to XML, I want to pass values from XML to JSP. I have a xml file with attributes, I should send this values to a JSP file. How is it??? Please Help guys.... its very urgent. Please send me how to do it with an example or atleast any urls related that....
    Looking for ur favourable reply.
    Thanks in advance,
    Sridhar

    in a servlet :
    parse your xml file (see how at the end of the post) and
    put the values you want in the request attributes
    request.setAttribute("value1", value1);
    ...redirect to the jsp
    in the JSP:
    get the wanted attributes:
    String value1=(String)request.getAttribute("value1");To learn how to parse a xml file, pay a look at this page, it explains how to read the XML document to build an object representation, and then how to navigate through this object to get the data
    http://labe.felk.cvut.cz/~xfaigl/mep/xml/java-xml.htm

  • Fetch value from Table with respect to APP_USER.

    Hi,
    i want to fetch value from Table with respect to APP_USER.
    i am using
    SELECT ID,NAME,FILE_OBJ_ID,MIME_TYPE,DOC_SIZE,BLOB_CONTENT,DESCRIPTION,UPLOAD_DATE,'Download' FROM DUMY_FILE where CREATED_BY =:APP_USER;
    Show me error
    failed to parse SQL query:
    ORA-00911: invalid characterThanks
    Edited by: 805629 on Jan 13, 2011 2:09 AM

    Hello,
    I too have the same problem.
    I am using this query:
    select manager from leave_mgmt where support_engg=:APP_USER
    and source type is SQL Query(return single value)
    but nothing is coming up in the text field. Its empty.
    Please advice. Thanks in advance.

  • Read bool value from xml

    Hi all :
    I try to read Boolean value from xml file , please see attach file , all the time this error rise
    I know that The XML tag describing the type of data does not match, how can I get Boolean value " 1" or "0 "
    Thanks
    wisam
    Attachments:
    untitled1.JPG ‏115 KB

    You are not trying to read boolean.. you are trying to read a DBL.
    To read a DBL you must first write a DBL to XML.
    To read a boolean replace the DBL with a boolean

  • How to get string value from xml in JSF??

    In JSF How to get string value from xml, .ini and properties file. I want to get string value from xml or text to JSF

    Just use the appropriate API's for that. There are enough API's out which can read/parse/write XML, ini and properties files. E.g. JAXP or DOM4J for xml files, INI4J for ini files and Sun's own java.util.Properties for propertiesfiles.
    JSF supports properties files as message bundle and resource bundle so that you can use them for error messages and/or localization.

  • Save the selected value from listbox with its respective tab control dropdown selcted values in another listbox

    Hi all,
    I am making a vi where I have to save the selected value from listbox with its respective tab control dropdown selcted values in another listbox.Whenever I select Item1 then the heading change and respective tab will open for that item.But Now I just want to save the selection and put it in another ListBox.SO that I can renmove or add according to my wish. Plz help me.
    Solved!
    Go to Solution.
    Attachments:
    my_vi.png ‏83 KB

    Hi, I successfully make the vi to insert itmes from listbox1 to listbox2.Whenever I select itmes 1 in listbox 1 it display same elected item in listbox2 , but it not appending the items in listbox2.Like If 1 is selected in listbox1 then 1 will display , next time after saving when I selct next item like 3 then in listbox 2, 1 is replaced by 3,it dont come in second row of listbox2.Hope I am able to explain.\
    Plz help me to resolve this.
    Attachments:
    listbox_update.vi ‏11 KB

  • Using WQL "one-liner" to extract a value from the registry

    Can I extract a value from the registry using a "one-liner" WQL command?  Something like the following:
    Under root\default:StdRegProv
                   SELECT <Data> FROM "HKLM:SOFTWARE\Toto\Version"
    Please note that I am aware of how this is done via script.  The problem is that I'm using a management system (SCOM), which only allows me to supply a simple WQL query to perform my evaluation.
    Thanks,
    Larry

    Hi Larry,
    There have a specific forum to support the scripting related question, i sugges you ask in Scripting forum there will have more
    professional engineer will help you.
    The Official Scripting Guys Forum!
    https://social.technet.microsoft.com/Forums/en-US/9d5a7990-b975-488a-b7c0-6d866f29cf0a/change-mouse-scheme?forum=ITCG
    Best Regards,
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Support, contact [email protected]

  • XML parser for fatching multiple values from XML

    Hi,
    In my scenirio i have to facth multiple values from XML file and then set in to Table in webdynpro...
    Fo example my xml has values like...
    <xml>
         <item>
              <item1>
                   <quantity>
                        100
                   </quantity>
                   <price>
                        50
                   </price>
              </item1>
              <item2>
                   <quantity>
                        200
                   </quantity>
                   <price>
                        20
                   </price>
              </item2>
              <item3>
                   <quantity>
                        300
                   </quantity>
                   <price>
                        10
                   </price>
              </item3>
         </item>
    </xml>
    then i have to fcath those quantity and price and set in to table...
    How to do taht in webdynpro and does any one have parser code for retriving multiple values...

    Hi,
    1) You need to use JDOM parser.
    2) The code for parsing XML using JDOM parser is readily available if you search on google.
    3) You will have to check the attribute during every parsing and then if attribute is quantity you can fetch the corresponding tags.
    4) Something similar to this:
    org.jdom.Document document = parser.build(file);
                    org.jdom.Element rootElement = document.getRootElement();
                    org.jdom.Element childElement = rootElement.getChild("file");
                    Element xmlElement = childElement.getChild("item");
                    if (xmlElement != null) {
                        List itemElementsList = xmlElement.getChildren("item1");
                        if (itemElementsList != null) {
                            Iterator iterator3 = itemElementsList.iterator();
                            while (iterator3.hasNext()) {
                                //For each group get quantity
                                Element itemElement = (Element) iterator3.next();
                                List quantityElementsList =
                                        itemElement.getChildren("quantity");
                                if (quantityElementsList != null) {
                                    Iterator iterator2 =
                                            quantityElementsList.iterator();
                                    while (iterator2.hasNext()) {
    // Your code                                                                               
    You might need to make some changes as per your rquirement. Just use this sample to understand how you need to parse the xml
    Hope it helps.
    Regards.
    Rajat
    Edited by: Rajat Jain on Jan 22, 2009 9:51 AM

  • Want to retrieve null value from xml?

    i m writing this code to get the tag name and values from xml file.
    Now the problem is that
    if my xml file contain any tag whose value is not defined like
    <root>
    <firsttag>first</firsttag>
    <Second></Second><Third>third</Third>
    </root>
    Now look if second tag doesnt contain anything ,then i want to add "null" to vector,but it throws null pointer exception because second tag is empty.
    Vector<String> CSWFinfo = new Vector<String>();
              try {
                   DocumentBuilderFactory factory = DocumentBuilderFactory
                             .newInstance();
                   DocumentBuilder builder = factory.newDocumentBuilder();
                   Document doc = builder.parse(new File(xml));
                   Element root = doc.getDocumentElement();
                   NodeList node = root.getChildNodes();
                   for (int i = 0; i < node.getLength(); i++) {
                        Node currentNode = node.item(i);
                        if (isTextNode(currentNode))
                             continue;
                        CSWFinfo.addElement(currentNode.getNodeName());
                        if (null != currentNode.getFirstChild().getNodeValue()) {
                             CSWFinfo.addElement(currentNode.getFirstChild()
                                       .getNodeValue());
                        } else {
                             CSWFinfo.addElement("null");
                   }//end of for loop block
                   System.out.println(CSWFinfo);
              } catch (Exception e) {
                   e.printStackTrace();
                   // TODO: handle exception
              }I am using dom parser .
    Can any one know how to do it????
    Edited by: chauhan2003 on 16 Jun, 2008 12:06 PM

    Are you sure that all currentNode have a firstChild ????
    If your node has no value, it has no child
    So i 'd change code to like look something like:
    if (currentNode.getFirstChild() != null) {
         CSWFinfo.addElement(currentNode.getFirstChild().getNodeValue());
    } else {
         CSWFinfo.addElement("null");
    }

  • How to extract attribute value from an XML

    I have column where all my diffrent structures of XML's are getting stored. I want extract a patticular attribute value from all the XML’s. Can any one help me with this?
    Thanks,
    swagath

    Kindly refer to the EXTRACTVALUE function in your online documentation and refrain from further doc questions.
    Sybrand Bakker
    Senior Oracle DBA

Maybe you are looking for

  • CSS does't work for new Web Form wpc_mini_article

    Hello, I created a new web form following [this guide|https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/2041eb17-6001-2b10-b08d-b95ce55fa9b7], which works pretty good. The problem is that I personalized the sdn_general.css file but

  • Endless loop condition

    Hi there, Working on a client/server chat application. On the client side app, everytime I want to send a message I create a new Thread called "SendingThread". See below. import java.io.*; import java.net.*; public class SendingThread extends Thread

  • Why wont itunes open?

    it really wont open...

  • Add new key figs or characteristics and "Repair full request"

    Hi Gurus, here are my questions 1.If I add new key figs or characteristics(which are not Key fields) to ODS and Cube containing tons of data, Will the transport for structure changes fail due to presence of data? 2.The extractor to the ODS which intu

  • Access violation Internal string variable

    Hello , I have a code here that is kind of tricky to me. The code works fine when it it in the main function of my C program. BUT when I try to run the same code in a custom function that I create, I get the error Access violation writing location 0x