title: ORA-19011: Character string buffer too small - Is there a character limit on Regex_replace buffer limit in Oracle?
body: <p>I am getting the following error when I try to execute the below code.</p>
  
  <blockquote>
    <p>ORA-19011: Character string buffer too small</p>
  </blockquote>
  
  <pre><code>SELECT   filecontent
              FROM
        (SELECT  XMLTYPE(REGEXP_REPLACE(filecontent, '&lt;Transaction .*&gt;', '&lt;Transaction&gt;')) filecontent
         FROM example_table where somecondition = true)
         ) xmlContent
  </code></pre>
  
  <p>filecontent is a column whose type is XMLTYPE. We are storing a XML file in this column. </p>
  
  <p>This error occurs if the xml file contents is > 4000 characters. If any of the the xml file has &lt; 4000 characters this error doesn't occur.  We are in Oracle 11G. So as per the documentation we should be able to store 4GB of content in the <em>filecontent</em> column. I am thinking the problem is REGEXP_REPLACE function which tries to read the file contents where we are facing this issue with the buffer. I may be wrong. Any help in this regard is much appreciated.</p>