title: Converting DBCLOB/CLOB to XML
body: <p>We are facing a problem in converting/casting DBCLOB to XML. </p>
  
  <p><strong>Background</strong></p>
  
  <p>We are storing some xml data in a column of type DBCLOB (1073741823). For one of our requirements, we have to convert this data to <code>XML</code> type so that we can take advantage of <code>Xquery</code> to filter the result. For doing this conversion, we are using the following SQL query to convert DBCLOB to XML data type. </p>
  
  <pre><code>SELECT XMLCAST (XMLPARSE (DOCUMENT (CAST (CAST (COLUMN1 AS DBCLOB(32672)) AS VARCHAR (32672)))) AS XML from TABLE1 
  </code></pre>
  
  <p><strong>Problem</strong> </p>
  
  <p>For some scenario the size of data in DBCLOB column is more than 32672 
  and, since we are converting DBCLOB to XML via VARCHAR, so the output 
  get limited to 32672, and XML conversion fails. </p>
  
  <p>What would be the way to achieve this casting (clob to xml)</p>
  
  <p>Thanks in advance</p>