title: Inserting large XML document into Oracle
body: <p>I have a table in Oracle:</p>
  <pre class="lang-sql prettyprint-override"><code>CREATE TABLE foo (id NUMBER, document XMLType)
  </code></pre>
  <p>and I would typically insert data into it with SQL:</p>
  <pre class="lang-sql prettyprint-override"><code>INSERT INTO foo VALUES (1, XMLType('&lt;parent&gt;&lt;child&gt;&lt;/child&gt;&lt;/parent&gt;'))
  </code></pre>
  <p>However, I now have a document which is more than the maximum size for a string literal in PL/SQL (4000 characters). Is it possible to insert such a document in a single SQL script, without resorting to writing it to a file and then referencing that file in the sql... as that option is not open to us for reasons. I have tried:</p>
  <ul>
  <li>inserting 4000 characters, then appending the rest in chunks - this does not work as the intermediate steps fail XML validation</li>
  <li>temporarily changing the column type to <code>CLOB</code> etc. - Oracle forbids the conversion of columns between major types.</li>
  </ul>