XML to CLOB conversion

Hello
I have a XMLTYPE field.
And I need to remove all the XML Tags and save it as CLOB.
I tried using Regexp_replace or replace but it throws
ORA-19011: Character string buffer too small error?
Any other techniques?
Parth

Hi,
You can use getCLOBval() for conversion.
CREATE TABLE EMP2 (EMPCODE NUMBER(8),EMPNAME VARCHAR2(100),EMPDEPTNO NUMBER(8),EMPSAL NUMBER(34,2));
create table EMPXML(XMLCLOB XMLTYPE);
BEGIN
FOR X IN (SELECT * FROM USER_OBJECTS S WHERE ROWNUM<=50)
LOOP
INSERT INTO EMP2 VALUES (X.OBJECT_ID,X.OBJECT_NAME,20,X.OBJECT_ID+10);
END LOOP;
COMMIT;
END;
DECLARE
v_xmldata CLOB;
BEGIN
SELECT Xmlelement("Employee",
Xmlagg(Xmlforest(e.Empcode AS "EmpId",
e.Empname AS "EmpName",
e.Empsal AS "EmpSal"))).getclobval() INTO v_xmldata
FROM Emp2 e;
INSERT INTO empxml VALUES (xmltype(v_xmldata));
END;
SELECT * FROM empxml;
DROP TABLE emp2 PURGE;
DROP TABLE empxml PURGE;

Similar Messages

  • J2SE adapter PI 7.1 issue with XML to flat conversion and namespace length

    Dear reader,
    We are facing an issue with J2SE Adapter PI7.1 for a number of flows.
    The flow requirements:
    [1] Namespace length for interfaces is up to 100 characters
    [2] The XML message must be converted to Flat on the adapter channel
    Our PI system is at patch level 7 and we implement J2SE adapter on patch level 7 as well.
    We found that the J2SE adapter on patch level 7 does not support long namespaces [1] (as it should since this is an PI 7.1 j2SE adapter) but no issues where found with the XML to flat conversion [2].
    Experimenting with J2SE adapter on patch level 6 we found the long namespaces [1] are supported however an issue is found with the XML to flat conversion [2] as stated in SAP note 1335527.
    An SAP Customer Message is raised on this issue however your input is highly appricated!
    With Kind Regards,
    Harald Kastelijn
    Edited by: Harald Kastelijn on Mar 6, 2010 9:17 AM
    Edited by: Harald Kastelijn on Mar 6, 2010 9:19 AM

    We found that the J2SE adapter on patch level 7 does not support long namespaces [1] (as it should since this is an PI 7.1
    j2SE adapter) but no issues where found with the XML to flat conversion [2]
    I think the restriction of namespace length still remains in design time (IR).....the same however has been extended in configuration and runtime...this SAP note has some information: https://service.sap.com/sap/support/notes/870809

  • Storing and searching XML in CLOBs

    Speaking to an oracle employee at the Oracle booth at JavaOne
    recently. They suggested I store XML in CLOBs
    and use the DOM or SAX to reparse the XML later as needed.
    I agreed that this was the best solution for my problem
    (which was how to manage many different XML documents using many
    different DTDs in a document management system)
    The big problem was searching this document repository
    to locate relevant information.
    This is where Intermedia seemed ideal (still does).
    It would be nice to see an example of setting this up using
    Intermedia in Oracle 8i, demonstrating how to define the
    XML_SECTION_GROUP and where to use a ZONE as opposed to a FIELD
    etc.
    Anybody care to take a shot at this ????
    For example:
    How would I define Intermedia parameters
    so that I would be able to search my CLOB
    column for records that had the <keyword>
    "aorta" and "damage" in the <caption>
    using the following
    XML (DTD implied)
    <image filename="OurImageName.gif">
    <fname>WellKnownFileName.gif</fname>
    <keyword>echocardiogram</keyword>
    <keyword>aorta</keyword>
    <caption>This is an image of the vessel damage</caption>
    </image>
    Thanks
    Thomas Bennett
    null

    Eric (guest) wrote:
    : You can't do XML structure-based searches with intermedia. You
    : can search for text within a given element, but nothing more
    : complicated than that.
    The example he gave involves exactly that -- searching for
    text within XML elements. interMedia can do this.
    : It also does not do attributes.
    Upcoming 8.1.6 version allows searching within
    attribute text. That's something like:
    dog within book@author
    We're working on attribute value sensitive search,
    more like:
    dog within book[@author = "Eric"]
    : Thomas Bennett (guest) wrote:
    : : How would I define Intermedia parameters
    : : so that I would be able to search my CLOB
    : : column for records that had the <keyword>
    : : "aorta" and "damage" in the <caption>
    : : using the following
    : : XML (DTD implied)
    : : <image filename="OurImageName.gif">
    : : <fname>WellKnownFileName.gif</fname>
    : : <keyword>echocardiogram</keyword>
    : : <keyword>aorta</keyword>
    : : <caption>This is an image of the vessel damage</caption>
    : : </image>
    begin
    ctx_ddl.create_section_group('mygrp','basic_section_group');
    ctx_ddl.add_field_section('mygrp','keyword','keyword');
    ctx_ddl.add_field_section('mygrp','caption','caption');
    end;
    create index myidx on mytab(mytxtcolumn)
    indextype is ctxsys.context
    parameters ('section group mygrp');
    select * from mytab
    where contains(mytxtcolumn, 'aorta within keyword')>0;
    options:
    * use XML section group instead of basic section group
    if your tags have attributes or you need case-sensitive
    tag detection
    * use zone sections instead of field sections if your
    sections overlap, or if you need to distinguish
    between instances. For instance, keywords. If keywords
    is a field section, then
    (aorta and echocardiogram) within keywords
    finds the document. if it is a zone section, then it
    doesn't, because they are not in the SAME instance of
    keywords.
    null

  • XML-2-TXT conversion

    All,
    We have a small, annoying problem with xml-2-text conversion.  During the conversion, the "&amp;: in the XML file is not translated to "&" (ampersand).
    We encounter this issue with the xml-2-txt convertor of the file adapter of the standalone J2SE adapter.
    Anyone having a simple workaround for this small but annoying issue?
    Kind regards, Guy Crets

    I have not used the J2Se adapter, however I wrote a java mapping program that converts XML2TXT, it is highly experimental. You may use it as the last mapping in the mapping program "chain". The XSLT is at the end.
    I have tested this with
    XML -> fileadapter -> SAP XI javamapping -> http adapter -> MS IIS.
    Good luck /Otto
    Created on 2005-dec-05
    To change the template for this generated file go to
    Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments
    @author 01ottfro Otto Frost Capgemini
    To change the template for this generated type comment go to
    Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments
    import java.io.InputStream;
    import java.io.OutputStream;
    import java.util.Map;
    import java.util.HashMap;
    import com.sap.aii.mapping.api. AbstractTrace;
    import com.sap.aii.mapping.api.StreamTransformation;
    import com.sap.aii.mapping.api.StreamTransformationConstants;
    //import java.io.*;
    import javax.xml.parsers.DocumentBuilder;
    import javax.xml.parsers.DocumentBuilderFactory;
    //import javax.xml.parsers.FactoryConfigurationError;
    import javax.xml.parsers.ParserConfigurationException;
    import org.xml.sax.SAXException;
    import org.xml.sax.SAXParseException;
    //import java.io.File;
    import java.io.IOException;
    import java.io.ByteArrayInputStream;
    //import java.io.ByteArrayOutputStream;
    import java.io.StringReader;
    //import java.io.IOException;
    import java.io.InputStreamReader;
    import java.io.UnsupportedEncodingException;
    import org.w3c.dom.Document;
    //import org.w3c.dom.DOMException;
    import org.w3c.dom.Element;
    import org.w3c.dom.Node;
    //import javax.xml.parsers.*;
    import org.w3c.dom.NodeList;
    import org.w3c.dom.NamedNodeMap;
    public class XML2TEXT implements StreamTransformation {
      private Map           param = null;
      private AbstractTrace  trace = null;
      private StringBuffer sbTrace = new StringBuffer();
      public void setParameter (Map param) {
        this.param = param;
        //if (param == zero) {
        if ((param == null)) {
               this.param = new HashMap();
      public void execute(InputStream in, OutputStream out) {
        try {
          //javax.xml.parsers.DocumentBuilderFactory = "";
           trace = (AbstractTrace)param.get(
             StreamTransformationConstants.MAPPING_TRACE);
           trace.addInfo("Start");
           trace.addInfo(System.getProperty("javax.xml.parsers.DocumentBuilderFactory "));
           InputStreamReader isr = new InputStreamReader(in,"UTF-8");
           in.reset();
           StringBuffer sb2 = new StringBuffer();
           char c;
           int i = isr.read();
           while (i != -1) {
                c = (char) i;
              sb2.append(c);
              i = isr.read();
           String ss = new String(sb2);
           trace.addInfo(ss);
           in.reset();
           String receiverName = (String)param.get(
             StreamTransformationConstants.RECEIVER_NAME);
           //static Document document;
           Document document;
           StringBuffer sb = new StringBuffer();
           StringBuffer sbTrace = new StringBuffer();
           sb.append("");
           sb.append("<?xml version=\"1.0\"?>");
           sb.append("<DOC>");
    //          sb.append("<greeter>An XSLT Programmer</greeter>");
    //          sb.append("<greeting>Hello, World!</greeting>");
           sb.append("<TEXT>x_content_x</TEXT>");
           sb.append("</DOC>");
           //String s = sb.ToString();
           StringReader sr = new StringReader(sb.toString());
           DocumentBuilderFactory dbf = new DocumentBuilderFactory();
           dbf.setCoalescing(true);
           dbf.setExpandEntityReferences(true);
           dbf.setIgnoringComments(true);
           dbf.setIgnoringElementContentWhitespace(false);
           dbf.setNamespaceAware(true);
           dbf.setValidating(true);
           DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
           factory.setCoalescing(true);
           factory.setExpandEntityReferences(true);
           factory.setIgnoringComments(true);
           factory.setIgnoringElementContentWhitespace(false);
           factory.setNamespaceAware(true);
           factory.setValidating(false);
           try {
              DocumentBuilder builder = factory.newDocumentBuilder();
             builder.setErrorHandler(
               new org.xml.sax.ErrorHandler() {  // ignore fatal errors (an  exception is guaranteed)
                 public void fatalError(SAXParseException exception)
                 throws SAXException {
                 // treat validation errors as fatal
                 public void error(SAXParseException e)
                 throws SAXParseException {
                   throw e;
                 // dump warnings too
                 public void warning(SAXParseException err)
                 throws SAXParseException {
                   System.out.println("** Warning"
                      + ", line " + err.getLineNumber()
                      + ", uri " + err.getSystemId());
                        trace.addInfo("** Warning"
                        + ", line " + err.getLineNumber()
                        + ", uri " + err.getSystemId());  
                   System.out.println("   " + err.getMessage());
                     trace.addInfo("   " + err.getMessage());
              //document = builder.parse( new File(args[0]) );
              ByteArrayInputStream bais = new
              ByteArrayInputStream(sb.toString().getBytes("UTF-8"));
                //System.out.println (bais.toString());
              //document = builder.parse(bais);
              document = builder.parse(in);
              Element documentRootElement = document.getDocumentElement();
              trace.addInfo("root" + documentRootElement.getNodeValue());
              trace.addInfo("root" + Short.toString(documentRootElement.getNodeType()));
              trace.addInfo("root" + documentRootElement.getNodeName());
    //          Element textElement = (Element) documentRootElement.getFirstChild();
              NodeList nodeList = documentRootElement.getElementsByTagName("TEXT");
            StringBuffer sbText = new StringBuffer();
              for(i = 0; i<nodeList.getLength() ;i++) {
                   Element textElement = (Element) nodeList.item(i);
                   Node text = textElement.getFirstChild();
                   sbText.append(text.getNodeValue());
              nodeList = documentRootElement.getElementsByTagName("CHARSETNAME");
              StringBuffer sbCharset = new StringBuffer();
              for(i = 0; i<nodeList.getLength() ;i++) {
                   Element textElement = (Element) nodeList.item(i);
                   Node text = textElement.getFirstChild();
                   sbCharset.append(text.getNodeValue());
    //          System.out.println(textElement.getNodeValue());
    //          System.out.println(textElement.getNodeType());
    //          System.out.println(textElement.getNodeName());
              trace.addInfo("te" + textElement.getNodeValue());
              short nodeType = textElement.getNodeType();
              trace.addInfo("te" + Short.toString(nodeType));
              trace.addInfo("te" + textElement.getNodeName());
              Node textNode = textElement.getFirstChild();
              Node mt_textdocument = document.getFirstChild();
              Node text = mt_textdocument.getFirstChild();
              Node hashtext = text.getFirstChild();
              textNode = hashtext;
              String s = new String();
              if (textNode != null) {          
                   trace.addInfo(textNode.getNodeValue());
                   trace.addInfo(Short.toString(textNode.getNodeType()));
                   trace.addInfo(textNode.getNodeName());
                  s = new String(textNode.getNodeValue());
              else {
                   s = "ERROR";
                   trace.addInfo(s);
    //          traverse1(document);
    //          trace.addInfo(sbTrace.toString());
    //          OutputStream baos = new ByteArrayOutputStream();
            String s = sbText.toString();
            String charset = sbCharset.toString();
              byte[] bytes = s.getBytes(charset);
    //          baos.write(bytes,0,bytes.length);
            out.write(bytes,0,bytes.length);
           } catch (SAXException sxe) {
               // Error generated during parsing
               Exception  x = sxe;
               if (sxe.getException() != null)
                    x = sxe.getException();
               x.printStackTrace();
           } catch (ParserConfigurationException pce) {
               // Parser with specified options can't be built
               pce.printStackTrace();
           } catch (IOException ioe) {
               // I/O error
               ioe.printStackTrace();
         catch (UnsupportedEncodingException uee) {
              trace.addInfo("UnsupportedEncodingException");
        catch (IOException ioe) {
          // I/O error
          //  ioe.printStackTrace();
           trace.addInfo("IOException");
        finally {
              trace.addInfo("finally");
      public void traverse1(Node node) {
           do {
               System.out.println("Node: name=" + node.getNodeName() +
               ", value=" + node.getNodeValue() + ", type=" +
               node.getNodeType());
               sbTrace.append("Node: name=" + node.getNodeName() +
              ", value=" + node.getNodeValue() + ", type=" +
              node.getNodeType() + "\n");
              trace.addInfo("Node: name=" + node.getNodeName() +
              ", value=" + node.getNodeValue() + ", type=" +
              node.getNodeType() + "\n");
               if (node.getFirstChild() != null) {
                System.out.println("Processing children:");
                sbTrace.append("Processing children:"+"\n");
                trace.addInfo("Processing children:"+"\n");
                traverse1(node.getFirstChild());
           }  while ((node = node.getNextSibling()) != null);
         public void traverse2(Node node) {
              //Get the children of this Node
                NodeList children = node.getChildNodes();
                //go through all the children of the node
                for (int i=0; i<children.getLength(); i++) {
                    //get the next child
                    Node child = children.item(i);
                    //get the type of the child
                    short childType = child.getNodeType();
                    if (childType == Node.ELEMENT_NODE) {
                   //if the child is an Element then print the start and end
                   //tags and recurse the content       
                   String nodeName = child.getNodeName();
                   System.out.print("<" + nodeName + ">");
                   sbTrace.append("<" + nodeName + ">");
                   trace.addInfo("<" + nodeName + ">");
                   traverse2(child);
                   System.out.print("</" + nodeName + ">");
                   sbTrace.append("</" + nodeName + ">");
                   trace.addInfo("</" + nodeName + ">");
                } else if (childType == Node.TEXT_NODE) {
                   //if the child is a Text node just print the text content
                   String data = child.getNodeValue();
                   System.out.print(data);
                   sbTrace.append(data);
                   trace.addInfo(data);
         public void traverse3(Node node, int indent) {
              for (int i = 0; i < indent; i++) {
                System.out.print("   ");
                sbTrace.append("   ");
                trace.addInfo("   ");
              int type = node.getNodeType();
              switch (type) {
              case Node.ATTRIBUTE_NODE:
                System.out.println("ATTRIBUTE_NODE");
                sbTrace.append("ATTRIBUTE_NODE"+"\n");
                trace.addInfo("ATTRIBUTE_NODE"+"\n");
                break;
              case Node.CDATA_SECTION_NODE:
                System.out.println("CDATA_SECTION_NODE");
                sbTrace.append("CDATA_SECTION_NODE"+"\n");
                trace.addInfo("CDATA_SECTION_NODE"+"\n");
                break;
              case Node.COMMENT_NODE:
                System.out.println("COMMENT_NODE");
                sbTrace.append("COMMENT_NODE"+"\n");
                trace.addInfo("COMMENT_NODE"+"\n");
                break;
              case Node.DOCUMENT_FRAGMENT_NODE:
                System.out.println("DOCUMENT_FRAGMENT_NODE");
                sbTrace.append("DOCUMENT_FRAGMENT_NODE"+"\n");
                trace.addInfo("DOCUMENT_FRAGMENT_NODE"+"\n");
                break;
              case Node.DOCUMENT_NODE:
                System.out.println("DOCUMENT_NODE");
                sbTrace.append("DOCUMENT_NODE"+"\n");
                trace.addInfo("DOCUMENT_NODE"+"\n");
                break;
              case Node.DOCUMENT_TYPE_NODE:
                System.out.println("DOCUMENT_TYPE_NODE");
                sbTrace.append("DOCUMENT_TYPE_NODE"+"\n");
                trace.addInfo("DOCUMENT_TYPE_NODE"+"\n");
                break;
              case Node.ELEMENT_NODE:
                System.out.println("ELEMENT_NODE");
                sbTrace.append("ELEMENT_NODE"+"\n");
                trace.addInfo("ELEMENT_NODE"+"\n");
                NamedNodeMap atts = node.getAttributes();
                for (int i = 0; i < atts.getLength(); i++) {
                   Node att = atts.item(i);
                   traverse3(att, indent + 1);
                break;
              case Node.ENTITY_NODE:
                System.out.println("ENTITY_NODE");
                sbTrace.append("ENTITY_NODE"+"\n");
                trace.addInfo("ENTITY_NODE"+"\n");
                break;
              case Node.ENTITY_REFERENCE_NODE:
                System.out.println("ENTITY_REFERENCE_NODE");
                sbTrace.append("ENTITY_REFERENCE_NODE"+"\n");
                trace.addInfo("ENTITY_REFERENCE_NODE"+"\n");
                break;
              case Node.NOTATION_NODE:
                System.out.println("NOTATION_NODE");
                sbTrace.append("NOTATION_NODE"+"\n");
                trace.addInfo("NOTATION_NODE"+"\n");
                break;
              case Node.PROCESSING_INSTRUCTION_NODE:
                System.out.println("PROCESSING_INSTRUCTION_NODE");
                sbTrace.append("PROCESSING_INSTRUCTION_NODE"+"\n");
                trace.addInfo("PROCESSING_INSTRUCTION_NODE"+"\n");
                break;
              case Node.TEXT_NODE:
                System.out.println("TEXT");
                sbTrace.append("TEXT"+"\n");
                trace.addInfo("TEXT"+"\n");
                break;
              default:
                System.out.println("???");
                sbTrace.append("???"+"\n");
                trace.addInfo("???"+"\n");
                break;
              for (Node c = node.getFirstChild(); c != null; c =
              c.getNextSibling()) {
                traverse3(c, indent + 1);
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="urn:trema-com:trema:trema" targetNamespace="urn:trema-com:trema:trema">
         <xsd:element name="MT_TEXTDOCUMENT" type="DT_TEXTDOCUMENT" />
         <xsd:complexType name="DT_TEXTDOCUMENT">
              <xsd:annotation>
                   <xsd:appinfo source="http://sap.com/xi/TextID">
                   70d8cec1675c11da822400132107c3b7
                   </xsd:appinfo>
              </xsd:annotation>
              <xsd:sequence>
                   <xsd:element name="TEXT" type="xsd:string">
                        <xsd:annotation>
                             <xsd:appinfo source="http://sap.com/xi/TextID">
                             cc2dc340659311dab38eeb8f0ace6159
                             </xsd:appinfo>
                        </xsd:annotation>
                   </xsd:element>
                   <xsd:element name="CHARSETNAME" type="xsd:string">
                        <xsd:annotation>
                             <xsd:appinfo source="http://sap.com/xi/TextID">
                             bf0f424065c211da893ceb8f0ace6159
                             </xsd:appinfo>
                        </xsd:annotation>
                   </xsd:element>
              </xsd:sequence>
         </xsd:complexType>
    </xsd:schema>
    example xml
    <?xml version="1.0" encoding="utf-8"?>
    <MT_TEXTDOCUMENT><TEXT>your text</TEXT><CHARSETNAME>UTF-8</CHARSETNAME></MT_TEXTDOCUMENT>

  • XML in clob columns and OWB

    I’m building some ETL process to extract data from XML in CLOB columns. I know that there are solutions to use functions as extractvalue() of WB_XML_LOAD(), but I want to know if there is any other way to deal with XML. The reason for that is because my XML files have multiple namespaces and nodes, and I need something more complex to deal with that, since I already tried those two first solutions.
    My first solution was to create a PL/SQL that parses the XML and looks for tags and elements. It populates a relational table, and I might use OWB to extract the data from this table. But I’m dealing with a large table and it takes a while for processing, plus my code is hude!
    My question is: Does someone have any experience with complex XML in Clob columns? If so, what was your solution for that?
    Thanks a lot!
    Angelo Buss
    [email protected]

    CLOB is a fully-updateable, character large object that is stored inside the database. It can be text-indexed using interMedia for document searching.
    BFILE is a readonly pointer to a file on the external file system whose content is not physically stored in the database. It can also be text-indexed for document searching, but it can't be updated.

  • XML in CLOB or BFILE

    Could somebody tell me the different between save XML in CLOB and BFILE, addition to generic different between CLOB and BFILE, is there a performance issue?
    Thanks

    CLOB is a fully-updateable, character large object that is stored inside the database. It can be text-indexed using interMedia for document searching.
    BFILE is a readonly pointer to a file on the external file system whose content is not physically stored in the database. It can also be text-indexed for document searching, but it can't be updated.

  • Extract part of xml into CLOB or XMLType

    I need to extract part of XML into CLOB or some another type. But I don't need only extract data, by whole part od xml with elements. How could I do it in PL/SQL?
    For example from this xml:
    <bookstore>
    <book category="COOKING">
    <title lang="en">Everyday Italian</title>
    <author>Giada De Laurentiis</author>
    <year>2005</year>
    <price>30.00</price>
    </book>
    <book category="CHILDREN">
    <title lang="en">Harry Potter</title>
    <author>J K. Rowling</author>
    <year>2005</year>
    <price>29.99</price>
    </book>
    </bookstore>
    I need to get:
    "<book category="COOKING">
    <title lang="en">Everyday Italian</title>
    <author>Giada De Laurentiis</author>
    <year>2005</year>
    <price>30.00</price>
    </book>"
    THX

    That's why I need to process every book alone - to know which authors belongs to single book.For that specific requirement, a single query would do.
    Assuming variable "v_xml_clob" holds the XML document :
    <bookstore>
      <name>nameOfBookstore</name>
      <address>1st Avenue 24, SF</address>
          <book category="COOKING">
            <title lang="en">Everyday Italian</title>
            <author>
              <name>Giada De Laurentiis</name>
              <birth>1956</birth>
            </author>
            <author>
              <name>xxx</name>
              <birth>1955</birth>
            </author>
            <year>2005</year>
            <price>30.00</price>
          </book>
          <book category="CHILDREN">
            <title lang="en">Harry Potter</title>
            <author>
              <name>Rowning</name>
              <birth>1977</birth>
            </author>
            <author>
              <name>xxx</name>
              <birth>1955</birth>
            </author>
            <year>2005</year>
            <price>29.99</price>
          </book>
    </bookstore>You can do :
    SELECT *
    FROM XMLTable(
    'for $i in distinct-values($d//book/author/name)
      where count($d//book/author[name=$i]) = 1
      return $i'
    passing xmltype(v_xml_clob) as "d"
    columns author_name varchar2(80) path '.'
    AUTHOR_NAME
    Rowning
    Giada De Laurentiis

  • Migrating V9 to V10: Update XML Fragment CLOB does not work anymore

    I have an XML Schema that contains an element, named Operazione, mapped to a CLOB.
    I just migrate to Oracle 10.1.0.2.0 from version 9.2.0.2.0 and the code I developed does not work anymore.
    To get a CLOB on v 9.2.0.2.0 I issued the following statement:
    select extractValue(value(p),'/operazione.log/Operazione') from XMT_OPERAZIONE_LOG p
    where existsNode(value(p),'/operazione.log/Journal[NumeroElettronico=1234567890]') = 1
    To make it working on V10 I have to change it as follow:
    select extract(value(p),'/operazione.log/Operazione').getClobVal() from XMT_OPERAZIONE_LOG p
    where existsNode(value(p),'/operazione.log/Journal[NumeroElettronico=1234567890]') = 1
    So using extract intead of extractValue and adding getClobVal() I was able to read the CLOB.
    The problem that I was not able to solve is related to CLOB update. In V9 just adding the “for update” clause I was able to change the CLOB value on DB.
    In V10 if I run the V9 statement I get the error:
    ORA-03113: end-of-file on communication channel
    If I use the statement modified for V10, adding the “for update” clause, I get the CLOB and I can change the CLOB value but nothing goes on the DB. Probably I am working on a copy of the DB CLOB.
    If I remove the getClobVal() I get an OPAQUE type that I can use on a XMLType but, still, nothing is stored on DB.
    Any suggestion ?
    I tried with both OCI and Thin Client

    Can anybody help me ?
    Is it better to use different strategies ( eg. Stored Procedure, DBMS_XMLSTORE etc, etc. ) ?
    Any experience updatating XML Fragment CLOB on Oracle V10 ?

  • XSU error oracle.xml.sql.OracleXMLSQLException: Conversion to String failed

    Appication Server: 10g, Database: Oracle 9i and Oracle 10g
    I have a table 'sw_icd2' in the database that has one column of XMLType.
    The code below, attempts to query this table as 'select * from sw_icd2' and display the result. I was able to execute this query in sqlplus.
    But when I run a program using XSU in JDeveloper:
    OracleXMLQuery qry = new OracleXMLQuery(conn, "select * from sw_icd2");
    XMLDocument domDoc = (XMLDocument)qry.getXMLDOM();
    domDoc.print(System.out);
    StringWriter s = new StringWriter(10000);
    domDoc.print(new PrintWriter(s));
    System.out.println(s.toString());
    qry.close();
    I get the following Error:
    "oracle.xml.sql.OracleXMLSQLException: Conversion to String failed"
    Any ideas on how I can resolve this issue? Your help would be appreciated.
    Thanks!

    Okay, it looks like the problem has something to do with the TIMESTAMP data type in tables.
    oracle.xml.sql.query.OracleXMLQuery can't seem to handle tables with the TIMESTAMP data type.
    this code ran fine on my machine :
    import oracle.jdbc.driver.*;
    import oracle.xml.sql.query.OracleXMLQuery;
    import java.lang.*;
    import java.sql.*;
    public class testXMLSQL {
         public static void main(String[] args) {
    try {
    // Create the connection
    System.out.println("before getConnection ");
    Connection conn = getConnection("scott","tiger");
    System.out.println("after getConnection ");
    // Create the query class
    OracleXMLQuery qry = new OracleXMLQuery(conn, "SELECT * FROM EMP");
    System.out.println("after OracleXMLQuery object created ");
    // Get the XML string
    String str = qry.getXMLString();
    // Print the XML output
    System.out.println("The XML output is:\n"+str);
    // Always close the query to get rid of any resources..
    qry.close();
    } catch(SQLException e) {
    System.out.println(e.toString());
    // Get the connection given the user name and password.!
    private static Connection getConnection(String username,
    String password)
    throws SQLException
    // register the JDBC driver..
    DriverManager.registerDriver(new
    oracle.jdbc.driver.OracleDriver());
    // Create the connection using the OCI8 driver
    Connection conn =
    DriverManager.getConnection(
    "jdbc:oracle:thin:@<server_name>:1521:<sid>",
    username,password);
    return conn;
    Then I created another table :
    create table emp_test as select * from emp;
    added a timestamp to it :
    alter table emp_test add (time timestamp(6));
    and filled it with timestamp information :
    update emp_test set time = timestamp'2005-09-22 09:26:50.124';
    ran the same code but changed the SQL to :
    "SELECT * FROM EMP_TEST"
    and got the error message :
    The XML output is:
    <?xml version = '1.0'?>
    <ERROR>oracle.xml.sql.OracleXMLSQLException: Conversion to String failed</ERROR>
    looks like bug in OracleXMLQuery object??

  • Parse XML from CLOB field

    How can I parse XML from CLOB field? I need to replace or delete the node from XML document and update the database with new XML. I am using Oracle 9i release 2.
    Here is the XML. In this XML if section1 and section2 exists then I need to delete the section1 node. If section2 doesn't exist, replace section1 with section2 node.
    <Document ID='2' TypeID='2'>
    <Body>
    <Page Name='Page1'>
    <Sec ID='section1' Title='Section 1' GroupID='' />
    <Sec ID='section2' Title='Section 2' GroupID='' />
    </Page>
    </Body>
    </Document>
    Please help.. Thank you..

    In 9.2, you are limited into your options. Have a look into, among others, updateXML. Updating tp 10gR2 will give you more options to succeed.

  • Query to read XML from CLOB table column

    Hi
    I want an SQL to get the following information extract from a CLOB table column.
    MasterReport/sg:RptDef/sg:RptCell@RealDesc MasterReport/sg:RptDef/sg:RptCell@RealNum
    credits                              100
    debits                              100
    Sample XML data from table column is:
    <?xml version="1.0" encoding="UTF-8" ?>
    <MasterReport xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:sg="http://www.oracle.com/fsg/2002-03-20/" xsi:schemaLocation="http://www.oracle.com/2002-03-20/fsg.xsd">
    <sg:LDGName>Vision Portugal</sg:LDGName>
    <sg:SOBName>Vision Portugal</sg:SOBName>
    <sg:DataAccessSetName>Vision Portugal</sg:DataAccessSetName>
    <sg:InternalReportName>Model 30 Report</sg:InternalReportName>
    <sg:CustomParam10 />
    <sg:RowContext RowId="r100001">
    <sg:RowName />
    <sg:RowLineItem>Litigation Credits- Total amount from previous period</sg:RowLineItem>
    <sg:RowDispUnit>1</sg:RowDispUnit>
    <sg:RowDispFormat />
    <sg:RowUnitOfMeasure>EUR</sg:RowUnitOfMeasure>
    <sg:RowLedgerCurrency>ANY</sg:RowLedgerCurrency>
    <sg:RowCurrencyType>T</sg:RowCurrencyType>
    <sg:RowChangeSign>0</sg:RowChangeSign>
    <sg:RowSeq>1.0000000000000</sg:RowSeq>
    </sg:RowContext>
    <sg:RowContext RowId="r100002">
    <sg:RowName />
    <sg:RowLineItem>Litigation credits- Taxed amounts from column2 for Previous period</sg:RowLineItem>
    <sg:RowDispUnit>1</sg:RowDispUnit>
    <sg:RowDispFormat />
    <sg:RowUnitOfMeasure>EUR</sg:RowUnitOfMeasure>
    <sg:RowLedgerCurrency>ANY</sg:RowLedgerCurrency>
    <sg:RowCurrencyType>T</sg:RowCurrencyType>
    <sg:RowChangeSign>0</sg:RowChangeSign>
    <sg:RowSeq>2.0000000000000</sg:RowSeq>
    </sg:RowContext>
    <sg:ColContext ColId="c1000">
    <sg:ColAmountType />
    <sg:ColPeriod />
    <sg:ColPerOffset />
    <sg:ColChangeSign />
    <sg:ColPosition />
    <sg:ColSeq />
    <sg:ColWidth>100</sg:ColWidth>
    </sg:ColContext>
    <sg:ColContext ColId="c1001">
    <sg:ColName>Total</sg:ColName>
    <sg:ColDescr />
    <sg:ColDispUnit>1</sg:ColDispUnit>
    <sg:ColUnitOfMeasure>EUR</sg:ColUnitOfMeasure>
    <sg:ColLedgerCurrency>ANY</sg:ColLedgerCurrency>
    <sg:ColCurrencyType>T</sg:ColCurrencyType>
    <sg:ColDispFormat>999999999.99</sg:ColDispFormat>
    <sg:ColAmountType>YTD-Actual</sg:ColAmountType>
    <sg:ColPerOffset>0</sg:ColPerOffset>
    <sg:ColAmntId>14</sg:ColAmntId>
    <sg:ColParamId>-1</sg:ColParamId>
    <sg:ColType>A</sg:ColType>
    <sg:ColStyle>B</sg:ColStyle>
    <sg:ColPeriod>10-08</sg:ColPeriod>
    <sg:ColPeriodYear>2008</sg:ColPeriodYear>
    <sg:ColPeriodNum>11</sg:ColPeriodNum>
    <sg:ColPeriodStart>2008-10-01T00:00:00</sg:ColPeriodStart>
    <sg:ColPeriodEnd>2008-10-31T00:00:00</sg:ColPeriodEnd>
    <sg:ColChangeSign>0</sg:ColChangeSign>
    <sg:ColHeadLine1>Totals</sg:ColHeadLine1>
    <sg:ColHeadLine2 />
    <sg:ColHeadLine3 />
    <sg:ColHeadLine4 />
    <sg:ColHeadLine5 />
    <sg:ColHeadLine6 />
    <sg:ColHeadLine7 />
    <sg:ColHeadLine8 />
    <sg:ColHeadLine9 />
    <sg:ColPosition>99</sg:ColPosition>
    <sg:ColSeq>1.0000000000000</sg:ColSeq>
    <sg:ColWidth>14</sg:ColWidth>
    </sg:ColContext>
    <sg:RptDef RptId="p1001" RptDetName="Ledger=Vision PT (Vision Portugal)" RptPESegm="" RptPEVal="" RptTabLabel="Output 1 (Vision PT)">
    <sg:RptLine RptCnt="p1001" RowCnt="r100001" LineRowSeq="1.0000000000000" LinCnt="l100001">
    <sg:RptCell ColCnt="c1000" RealDesc="debits">debits</sg:RptCell>
    <sg:RptCell ColCnt="c1001" RealNum="100.000000">100.00</sg:RptCell>
    </sg:RptLine>
    <sg:RptLine RptCnt="p1001" RowCnt="r100002" LineRowSeq="2.0000000000000" LinCnt="l100002">
    <sg:RptCell ColCnt="c1000" RealDesc="creditsd">credits</sg:RptCell>
    <sg:RptCell ColCnt="c1001" RealNum="100.000000">100.00</sg:RptCell>
    </sg:RptLine>
    </sg:RptDef>
    <sg:TabCount>1</sg:TabCount>
    </MasterReport>
    Please help me.
    Regards
    Giri
    Edited by: user576087 on Mar 18, 2012 11:54 PM

    I'm not sure if you want the values from the attribute or the element, but this should give you a good start :
    SQL> alter session set nls_numeric_characters = ".,";
    Session altered
    SQL>
    SQL> select x.*
      2  from my_table t
      3     , xmltable(
      4         xmlnamespaces('http://www.oracle.com/fsg/2002-03-20/' as "sg")
      5       , '/MasterReport/sg:RptDef/sg:RptLine'
      6         passing xmltype(t.xmldoc)
      7         columns type    varchar2(30) path 'sg:RptCell[1]'
      8               , amount  number       path 'sg:RptCell[2]'
      9       ) x
    10  ;
    TYPE                               AMOUNT
    debits                                100
    credits                               100

  • XML Publisher CLOBS Help !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

    Can someone please help ..
    I am trying to display a clob field that contains just random text but when i run my xml definition on concurrant manager xdodtexe the field is displayed as blank,
    Does anyone know how i can display this clob field on my report template or is there a way to display it through my xml template using some kind of function... in the sql
    I am just selecting 4 Clob fields from a oracle table.
    xml publisher 5
    Oracle Apps 11
    Cheers
    Sharky

    Yeah simple select in xml definition file as below - Im getting a error when using getclobval()
    Error Not an object or Ref - Code Ora-22806
    Any Ideas
    -- start of code
    <?xml version = '1.0' encoding = 'UTF-8'?>
    <dataTemplate name="VAC_ADVERTISED" version="1.0">
    <parameters/>
    <dataQuery>
    <sqlStatement name="Q1">
    <![CDATA[SELECT   iv.vacancy_name,
    pv.attribute_category vacancy_type,
             iv.professional_area,
             iv.number_of_openings,
             iv.grade_name,
             TO_CHAR (pra.date_start, 'DD-MON-RRRR') VACANCY_START_DATE,
             TO_CHAR (pra.date_end, 'DD-MON-RRRR') VACANCY_END_DATE,
             ipcv.job_title, ipcv.org_name,
             hra.derived_locale LOCATION,
             hl.meaning route_area_teri,
             hl2.meaning grade_band,
             iv.recruiter_name,
             iv.manager_name
            , ipcv.org_description.getClobval() DEP_DESC
            , ipcv.brief_description.getClobval() BRF_DESC
            ,ipcv.detailed_description.getClobval() DET_DESC
             ,ipcv.additional_details.getClobval() HTAI
        FROM ircfv_vacancies iv,
             per_vacancies pv,
             per_positions pp,
             per_position_definitions ppd,
             per_jobs pj,
             per_job_definitions pjd,
             per_recruitment_activity_for praf,
             per_recruitment_activities pra,
             irc_all_recruiting_sites iars,
             irc_posting_contents_vl ipcv,
             per_recruitment_activity_for praf_ext,
             per_recruitment_activities pra_ext,
             irc_all_recruiting_sites iars_ext,
             irc_search_criteria isc,
             hr_lookups hl,
             hr_lookups hl2,
             hr_lookups hl3,
             hr_locations_all hra
       WHERE iv.vacancy_status = 'Approved'
         AND pp.position_id(+) = iv.position_id
         AND ppd.position_definition_id(+) = pp.position_definition_id
         AND pj.job_id(+) = iv.job_id
         AND pjd.job_definition_id(+) = pj.job_id
         AND praf.vacancy_id = iv.vacancy_id
         AND praf.recruitment_activity_id = pra.recruitment_activity_id
         AND pra.recruiting_site_id = iars.recruiting_site_id
         AND pra.posting_content_id = ipcv.posting_content_id
         AND iars.internal = 'Y'
         AND praf_ext.vacancy_id = iv.vacancy_id
         AND praf_ext.recruitment_activity_id = pra_ext.recruitment_activity_id
         AND pra_ext.recruiting_site_id = iars_ext.recruiting_site_id
         AND iars_ext.EXTERNAL = 'Y'
         AND iv.vacancy_id = isc.object_id(+)
         AND isc.object_type(+) = 'VACANCY'
         AND isc.attribute1 = hl.lookup_code(+)
         AND hl.lookup_type(+) = 'NR_RECRUIT_AREAS'
         AND iv.vacancy_id = isc.object_id(+)
         AND isc.object_type(+) = 'VACANCY'
         AND isc.attribute2 = hl2.lookup_code(+)
         AND hl2.lookup_type(+) = 'NR_RECRUIT_GRADE_BAND'
         AND isc.object_type(+) = 'VACANCY'
         AND isc.attribute3 = hl3.lookup_code(+)
         AND hl3.lookup_type(+) = 'NR_RECRUIT_JOB_TYPE'
         AND pv.vacancy_id(+) = iv.vacancy_id
         AND iars.site_name = 'iRecruitment Internal Site'
         AND iars_ext.site_name = 'iRecruitment External Site'
         AND pv.location_id = hra.location_id
    and  trunc(PRA.date_start) between trunc(sysdate,'IW') and TRUNC(SYSDATE)]]>
    </sqlStatement>
    </dataQuery>
    <dataStructure>
    <group name="VACANCY_INFO" source = "Q1">
    <element name="VACANCY_NAME" value ="VACANCY_NAME"/>
    <element name="PROFESSIONAL_AREA" value ="PROFESSIONAL_AREA"/>
    <element name="ORG_NAME" value ="ORG_NAME"/>
    <element name="LOCATION" value ="LOCATION"/>
    <element name="RECRUITER_NAME" value ="RECRUITER_NAME"/>
    <element name="MANAGER_NAME" value ="MANAGER_NAME"/>
    <element name="DEP_DESC" value ="DEP_DESC"/>
    <element name="BRF_DESC" value ="BRF_DESC"/>
    <element name="DET_DESC" value ="DET_DESC"/>
    <element name="HTAI" value ="HTAI"/>
    </group>
    </dataStructure>
    </dataTemplate>
    -- end of xml file

  • Error in StrictXml2PlainBean (XML to Text Conversion)

    Hi All,
    I am trying to convert the XML to Plain file in receiver file adapter. I am using module - StrictXml2PlainBean.
    Below is my target structure
    B2B_HEADER (1..1)                    Level1
    SHIPMENT_HEADER(1...1)          Level1
    SHIPMENT_CUSTOMER  (1..Unbounded)     Level1
       CARTON_HEADER     (1..Unbounded)         Level2 Child node of Shipment_customer
         CARTON_DETAIL  (1..Unbounded)         Level3 Child node of Carton_header
    I have mention below parameters in module tab,
                          B2B_Header.endSeparator             \n
         B2B_Header.fieldLengthExceeded     cut
         B2B_Header.fieldLengths     8,8,8,16,15,14,5,38,14,66,8
         Carton_Detail.endSeparator     \n
         Carton_Detail.fieldLengthExceeded     cut
         Carton_Detail.fieldLengths     6,14,4,10,14,10,35,10,6
         Carton_Header.endSeparator     \n
         Carton_Header.fieldLengthExceeded     cut
         Carton_Header.fieldLengths     6,20,20,12,2,7,2
         Shipment_Customer.endSeparator     \n
         Shipment_Customer.fieldLengthExceeded     cut
         Shipment_Customer.fieldLengths     6,8,10,40,40,40,40,40,10,2,15,40,1
         Shipment_Header.endSeparator     \n
         Shipment_Header.fieldLengthExceeded     cut
         Shipment_Header.fieldLengths     6,20,4,20,35,30,10,30,3,3,35,35,30,10,30,3,30,10,30,30,9,10,3,30,6,12,14,3
         recordTypes     B2B_Header,Shipment_Header,Shipment_Customer,Carton_Header,Carton_Detail
    I have getting below error in communicatipon channel monitoring...
    *Message processing failed. Cause: com.sap.aii.af.app.modules.conversion.xml2plain.ConversionException: The element nesting level for the structure Shipment_Customer is too deep (reference: 3 levels, found: 4 levels) at XML element CreateAndAcknowledgePickPackShipmentGIS_Async_V01,Shipment_Customer,Carton_Header,RecordIndicator
    RecordIndicator is a field in Carton_Header. Am i missing something in the configuration?
    Regards
    Amol
    Edited by: AMOL BHARTI on Dec 24, 2010 8:59 AM

    Hi Amol,
    You XML structure contains deep levels. As far as i understand about the StrictXML2PlainBean module, this is not capable of handling deep structures.
    This module is just an alternative to use FCC type functionality for other receiver adapters.
    Please take a look at these links:
    https://help.sap.com/saphelp_nwpi711/helpdata/EN/44/748d595dab6fb5e10000000a155369/content.htm
    StrictXml2PlainBean - to have an XML - EDI conversion?
    In case you want to achieve nested level content conversion, you may try this:
    /people/karthiknarayan.kesavan2/blog/2007/08/22/file-content-conversion-for-multi-hierarchical-structure
    I hope this helps.
    Regards, Gaurav.

  • From XML in CLOB to relational table doubt

    versions 11.2.0.2.0 / 10.2.0.4.0
    It's a long time, no see since my last dealing with xml and no luck to have an attribute value returned into the relational table.
    It's *<IntrBkSttlmAmt Ccy="???">999999</IntrBkSttlmAmt>*
    For the rest the below works in both versions but used on an xml having a 10000 <CdtTrfTxInf> on 11g it took 9 seconds and was killed because no answer was produced after 30 minutes on 10g. A colleague using java loaded the relational table in 34 seconds on 10g and produced the relational table on 11g in just 5 seconds.
    The 10g version is surviving with no xmldb installed and there are rumors our thinking heads didn't succeed to deactivate it on 11g yet.
    Any suggestion concerning alternate ways to produce a relational table from an xmltype located in a clob column of a relational table are welcome
    (looking at CLOB in XML to Normal table Best approach? I thought too many xmltable would have to be used)
    with
    the_data as
    (select q'~
                <Document xmlns="urn:iso:std:iso:20022:tech:xsd:pacs.008.001.01">
                   <pacs.008.001.01>
                      <GrpHdr>
                         <MsgId>1L1U000JB4UT1FVS</MsgId>
                         <MsgId>9X9X999XX9XX9XXX</MsgId>
                         <CreDtTm>YYYY-MM-DDTHH:MI:SS</CreDtTm>
                         <NbOfTxs>99999</NbOfTxs>
                         <TtlIntrBkSttlmAmt Ccy="???">9999999</TtlIntrBkSttlmAmt>
                         <IntrBkSttlmDt>YYYY-MM-DD</IntrBkSttlmDt>
                            <SttlmInf>
                               <SttlmMtd>XXXX</SttlmMtd>
                                  <ClrSys>
                                      <ClrSysId>XXXX</ClrSysId>
                                  </ClrSys>
                               </SttlmInf>
                      </GrpHdr>
                      <CdtTrfTxInf>
                         <PmtId>
                            <InstrId>XXXXXXX999999-XX999999.XX</InstrId>
                            <EndToEndId>X9999999999</EndToEndId>
                            <TxId>X9999-9999999999</TxId>
                         </PmtId>
                         <PmtTpInf>
                            <SvcLvl>
                               <Cd>XXXX</Cd>
                            </SvcLvl>
                        </PmtTpInf>
                        <IntrBkSttlmAmt Ccy="???">999999</IntrBkSttlmAmt>
                        <ChrgBr>XXXX</ChrgBr>
                        <InstgAgt>
                           <FinInstnId>
                              <BIC>XXXXXX9X</BIC>
                           </FinInstnId>
                        </InstgAgt>
                        <Dbtr>
                           <Nm>NAME</Nm>
                           <PstlAdr>
                              <AdrLine>ADDRESS</AdrLine>
                              <AdrLine>CITY</AdrLine>
                              <Ctry>XX</Ctry>
                           </PstlAdr>
                        </Dbtr>
                        <DbtrAcct>
                           <Id>
                              <IBAN>XX99999999999999999</IBAN>
                           </Id>
                        </DbtrAcct>
                        <DbtrAgt>
                           <FinInstnId>
                              <BIC>XXXXXX9X</BIC>
                           </FinInstnId>
                        </DbtrAgt>
                        <CdtrAgt>
                           <FinInstnId>
                              <BIC>XXXXXX9X</BIC>
                           </FinInstnId>
                        </CdtrAgt>
                        <Cdtr>
                           <Nm>NAME</Nm>
                           <PstlAdr>
                              <AdrLine>ADDRESS</AdrLine>
                              <AdrLine>CITY</AdrLine>
                              <Ctry>XX</Ctry>
                           </PstlAdr>
                        </Cdtr>
                        <CdtrAcct>
                           <Id>
                              <IBAN>XX99999999999999999</IBAN>
                           </Id>
                        </CdtrAcct>
                        <RmtInf>
                           <Strd>
                              <CdtrRefInf>
                                 <CdtrRef>X99999999-9999999999</CdtrRef>
                              </CdtrRefInf>
                              <AddtlRmtInf>ADDITIONAL INFO</AddtlRmtInf>
                           </Strd>
                        </RmtInf>
                      </CdtTrfTxInf>
                   </pacs.008.001.01>
                </Document>
              ~' the_column
       from dual
    select v.instrid,v.endtoendid,v.txid,v.cd,
           v.ccy,  /* returned as NULL - the only attribute value */
           v.intrbksttlmamt,v.chrgbr,v.bic1,v.nm1,v.adrline11,v.adrline12,v.ctry1,v.iban1,
           v.bic2,v.bic3,v.nm2,v.adrline21,v.adrline22,v.ctry2,v.iban2,v.cdtrref,v.addtlrmtinf
      from (select xmltype(the_column) the_column_xml
              from the_data
           ) w,
           xmltable(xmlnamespaces(default 'urn:iso:std:iso:20022:tech:xsd:pacs.008.001.01'),
                    'for $r in /Document/pacs.008.001.01/CdtTrfTxInf
                     return <rw>
                              <InstrId>{$r/PmtId/InstrId}</InstrId>
                              <EndToEndId>{$r/PmtId/EndToEndId}</EndToEndId>
                              <TxId>{$r/PmtId/TxId}</TxId>
                              <Cd>{$r/PmtTpInf/SvcLvl/Cd}</Cd>
                              <Ccy>{$r/IntrBkSttlmAmt/@Ccy}</Ccy>
                              <IntrBkSttlmAmt>{ora:replace($r/IntrBkSttlmAmt,"[.]",",")}</IntrBkSttlmAmt>
                              <ChrgBr>{$r/ChrgBr}</ChrgBr>
                              <BIC1>{$r/InstgAgt/FinInstnId}</BIC1>
                              <Nm1>{$r/Dbtr/Nm}</Nm1>
                              <AdrLine11>{$r/Dbtr/PstlAdr/AdrLine[1]}</AdrLine11>
                              <AdrLine12>{$r/Dbtr/PstlAdr/AdrLine[2]}</AdrLine12>
                              <Ctry1>{$r/Dbtr/PstlAdr/Ctry}</Ctry1>
                              <IBAN1>{$r/DbtrAcct/Id}</IBAN1>
                              <BIC2>{$r/DbtrAgt/FinInstnId}</BIC2>
                              <BIC3>{$r/CdtrAgt/FinInstnId}</BIC3>
                              <Nm2>{$r/Cdtr/Nm}</Nm2>
                              <AdrLine21>{$r/Cdtr/PstlAdr/AdrLine[1]}</AdrLine21>
                              <AdrLine22>{$r/Cdtr/PstlAdr/AdrLine[2]}</AdrLine22>
                              <Ctry2>{$r/Cdtr/PstlAdr/Ctry}</Ctry2>
                              <IBAN2>{$r/CdtrAcct/Id}</IBAN2>
                              <CdtrRef>{$r/RmtInf/Strd/CdtrRefInf/CdtrRef}</CdtrRef>
                              <AddtlRmtInf>{$r/RmtInf/Strd/AddtlRmtInf}</AddtlRmtInf>
                            </rw>'
                     passing w.the_column_xml
                     columns instrid         varchar2(300)   path '/rw/InstrId',
                             endtoendid      varchar2(150)   path '/rw/EndToEndId',
                             txid            varchar2(200)   path '/rw/TxId',
                             cd              varchar2(50)    path '/rw/Cd',
                             ccy             varchar2(50)    path '/rw/Ccy',
                             intrbksttlmamt  varchar2(50)    path '/rw/IntrBkSttlmAmt',
                             chrgbr          varchar2(100)   path '/rw/ChrgBr',
                             bic1            varchar2(100)   path '/rw/BIC1',
                             nm1             varchar2(1000)  path '/rw/Nm1',
                             adrline11       varchar2(1000)  path '/rw/AdrLine11',
                             adrline12       varchar2(1000)  path '/rw/AdrLine12',
                             ctry1           varchar2(50)    path '/rw/Ctry1',
                             iban1           varchar2(200)   path '/rw/IBAN1',
                             bic2            varchar2(100)   path '/rw/BIC2',
                             bic3            varchar2(100)   path '/rw/BIC3',
                             nm2             varchar2(1000)  path '/rw/Nm2',
                             adrline21       varchar2(1000)  path '/rw/AdrLine21',
                             adrline22       varchar2(1000)  path '/rw/AdrLine22',
                             ctry2           varchar2(50)    path '/rw/Ctry2',
                             iban2           varchar2(200)   path '/rw/IBAN2',
                             cdtrref         varchar2(1000)  path '/rw/CdtrRef',
                             addtlrmtinf     varchar2(1000)  path '/rw/AddtlRmtInf'
                   ) vRegards
    Etbin

    Hi,
    It's a long time, no see since my last dealing with xml and no luck to have an attribute value returned into the relational table.When you use this :
    <Ccy>{$r/IntrBkSttlmAmt/@Ccy}</Ccy>That doesn't set the value of the Ccy element with the attribute value, but actually add the attribute Ccy to the element Ccy, which results in
    <Ccy Ccy="???"></Ccy>Knowing that, you have three options :
    1) Leaving the XQuery as it is and using this instead in the COLUMNS clause :
                             ccy             varchar2(50)    path '/rw/Ccy/@Ccy',2) Modifying the XQuery to get the atomic value out of the attribute (using the fn:data function) :
                              <Ccy>{fn:data($r/IntrBkSttlmAmt/@Ccy)}</Ccy>3) Simplifying the whole thing, something like :
    select v.instrid, v.endtoendid, v.txid, v.cd, v.ccy,
           replace(v.intrbksttlmamt,'.',',') as intrbksttlmamt, v.chrgbr, v.bic1, v.nm1, v.adrline11, v.adrline12, v.ctry1, v.iban1,
           v.bic2, v.bic3, v.nm2, v.adrline21, v.adrline22, v.ctry2, v.iban2, v.cdtrref, v.addtlrmtinf
      from the_data w,
           xmltable(xmlnamespaces(default 'urn:iso:std:iso:20022:tech:xsd:pacs.008.001.01'),
                    '/Document/pacs.008.001.01/CdtTrfTxInf'
                     passing xmltype(w.the_column)
                     columns instrid         varchar2(300)   path 'PmtId/InstrId',
                             endtoendid      varchar2(150)   path 'PmtId/EndToEndId',
                             txid            varchar2(200)   path 'PmtId/TxId',
                             cd              varchar2(50)    path 'PmtTpInf/SvcLvl/Cd',
                             ccy             varchar2(50)    path 'IntrBkSttlmAmt/@Ccy',
                             intrbksttlmamt  varchar2(50)    path 'IntrBkSttlmAmt',
                             chrgbr          varchar2(100)   path 'ChrgBr',
                             bic1            varchar2(100)   path 'InstgAgt/FinInstnId',
                             nm1             varchar2(1000)  path 'Dbtr/Nm',
                             adrline11       varchar2(1000)  path 'Dbtr/PstlAdr/AdrLine[1]',
                             adrline12       varchar2(1000)  path 'Dbtr/PstlAdr/AdrLine[2]',
                             ctry1           varchar2(50)    path 'Dbtr/PstlAdr/Ctry',
                             iban1           varchar2(200)   path 'DbtrAcct/Id',
                             bic2            varchar2(100)   path 'DbtrAgt/FinInstnId',
                             bic3            varchar2(100)   path 'CdtrAgt/FinInstnId',
                             nm2             varchar2(1000)  path 'Cdtr/Nm',
                             adrline21       varchar2(1000)  path 'Cdtr/PstlAdr/AdrLine[1]',
                             adrline22       varchar2(1000)  path 'Cdtr/PstlAdr/AdrLine[2]',
                             ctry2           varchar2(50)    path 'Cdtr/PstlAdr/Ctry',
                             iban2           varchar2(200)   path 'CdtrAcct/Id',
                             cdtrref         varchar2(1000)  path 'RmtInf/Strd/CdtrRefInf/CdtrRef',
                             addtlrmtinf     varchar2(1000)  path 'RmtInf/Strd/AddtlRmtInf'
                   ) vThat last option could possibly get you some performance improvement as well.
    Edited by: odie_63 on 14 sept. 2011 20:57

  • Parsing xml in clob field remove non utf-8 characters

    hi all,
    i have an issue where a stored procedure runs during a nightly process and parses xml contained in a clob field. There are some records that contain non-utf8(they paste characters from word)characters and therefore the parse fails when using performing an xquery select against the clob field as xmltype. I was wondering if anyone knew of a handy way to handle such a situation? I have looked around a bit and not found anything that seemed tailored to my situation, and I would like something a bit more generic than doing a replace on individual characters that i have found causing issues...thx in advance! -- jp

    Hi,
    Like BluShadow I'm curious to see a test case...
    Depending on the way it's been created, the encoding declared in the XML prolog doesn't necessarily reflects the actual encoding of the content.
    What's your database character set, and version?
    Please also post the error message you get (LPX-00200 probably?).

Maybe you are looking for

  • How to reformat macbook pro 2.16

    I have a very old macbook pro 2.16 ghz and want to reformat it installing a newer OS. Any suggestions towards what I should install? Model Name:          MacBook Pro 15"   Model Identifier:          MacBookPro2,2   Processor Name:          Intel Core

  • Oracle Install on Mandrake Linux 9.1 (Dell Laptop 600)

    I have a full install of Oracle 10G running on a Dell Laptop using Mandrake Linux 9.1: First I did an install of the OS, I built the swap file to be 2GIGs, the /oracle partition as 5GIGS and the /home partition as 25GIGS. I made sure to choose the De

  • Best way to load music on the Ipod?

    what is the best way to do this?

  • Trying to create .pdfs but getting .log instead

    In trying to create .pdf files using Acrobat Standard 9 from different programs (Excel, Word, Internet Explorer), an empty .log file is created but no .pdf. I'm not sure what changed; it used to work just fine.

  • Monitor files accessed by a specific process

    Hi all, I'm trying to do the task in subject but I've no idea how to start... My goal is to check when a specific task (I've no control on it) opens up a specific file, in order to generate an alarm in an I/O board. Basically I want to develop in Lab