title: How to insert CLOB more then 1 Mb (1kk characters) in Oracle by script
body: <p>How to insert CLOB more then 1 Mb (1kk characters) in Oracle by script
  For exmpl. using pl slq, maybe append some parts less then 32767 bytes(chars).
  To bypass the problem: "PLS-00172: string literal too long".</p>
  
  <p>Here is my target table:</p>
  
  <pre><code>CREATE TABLE qon (x clob); 
  </code></pre>
  
  <p>Here is the code which throws the error:</p>
  
  <pre><code>DECLARE 
      l_clob clob := '32769 chars+ '; 
  BEGIN 
      FOR i IN 1..2 
      LOOP 
          INSERT INTO qon (x) VALUES (empty_clob()) --Insert an "empty clob" (not insert null) 
          RETURNING x INTO l_clob; -- Now we can append content to clob (create a 400,000 bytes clob) 
          FOR j IN 1..3 LOOP 
              dbms_lob.append(l_clob, rpad ('',4000,'')); --dbms_lob.append(l_clob, 'string chunk to be inserted (maximum 4000 characters at a time)'); 
          END LOOP; 
       END LOOP; 
  END;
  </code></pre>
  
  <p>Sorry, tomorow will correct. This idea - somehow insert string more then 32767 </p>
  
  <p>Urls I'm searched:</p>
  
  <blockquote>
    <p><a href="https://stackoverflow.com/questions/18394691/oralce-clob-cant-insert-beyond-4000-character">Oralce CLOB can&#39;t insert beyond 4000 character?</a></p>
    
    <p><a href="https://stackoverflow.com/questions/3790379/how-to-query-a-clob-column-in-oracle">How to query a CLOB column in Oracle</a></p>
    
    <p><a href="http://www.oradev.com/dbms_lob.jsp" rel="nofollow noreferrer">http://www.oradev.com/dbms_lob.jsp</a></p>
    
    <p><a href="https://stackoverflow.com/questions/3890567/how-to-write-oracle-insert-script-with-one-field-as-clob">How to write oracle insert script with one field as CLOB?</a>
    <a href="http://www.techonthenet.com/oracle/functions/rpad.php" rel="nofollow noreferrer">http://www.techonthenet.com/oracle/functions/rpad.php</a></p>
  </blockquote>
  
  <p><a href="https://stackoverflow.com/questions/8801814/how-to-insert-update-larger-size-of-data-in-the-oracle-tables">How to insert/update larger size of data in the Oracle tables? </a></p>
  
  <p><a href="https://www.aquaclusters.com/app/home/project/public/aquadatastudio/issue/8179" rel="nofollow noreferrer">https://www.aquaclusters.com/app/home/project/public/aquadatastudio/issue/8179</a></p>
  
  <p><a href="https://community.oracle.com/thread/2545044" rel="nofollow noreferrer">https://community.oracle.com/thread/2545044</a></p>
  
  <p>Thanks</p>