title: Read in CLOB objects into R as a string value
body: <p>I am looking to read in the data that is stored as a CLOB value in my Oracle database.  The contents simply are HTML that renders emails that we send through our CRM application.  I want to re-create images of the email to include in my reports on crm performance.</p>
  
  <p>I can successfully read the data into <code>SPSS</code> using the following query, which converts the CLOB to a string of length (32750).</p>
  
  <pre><code>GET DATA
    /TYPE=ODBC
    /CONNECT='DSN=&lt;MYDSN&gt;;UID=&lt;USER&gt;;PWD=mypassword;Host=myhost;Port=myport;SID='+
      'SID'
    /SQL='SELECT *  FROM mytable'
    /ASSUMEDSTRWIDTH=32750.
  CACHE.
  EXECUTE.
  DATASET NAME clob_query WINDOW=FRONT.
  </code></pre>
  
  <p>What I am looking to do is perform a similar query but read the data into R.  I attempted the following query and got the error below:</p>
  
  <pre><code>&gt; SQL &lt;-"SELECT to_char(CONTENT) as content from REL_EMAIL_TEMPLATE"
  &gt; ds &lt;- sqlQuery(ch, SQL, as.is=T, stringsAsFactors=F)
  &gt; ds
  [1] "HY000 22835 [Oracle][ODBC][Ora]ORA-22835: Buffer too small for CLOB to CHAR or BLOB to RAW conversion (actual: 5923, maximum: 4000)\n"
  [2] "[RODBC] ERROR: Could not SQLExecDirect 'SELECT to_char(CONTENT) as content from REL_EMAIL_TEMPLATE'"   
  </code></pre>
  
  <p>I am not sure how I can make the "buffer" larger, but figure that because I accomplish this in SPSS that R must be able to do this as well.</p>
  
  <p>Many thanks in advance.</p>