title: Java Class for retrieving Large String from Oracle_db of LOB dataType
body: <p>Have an oracle database with one of its fields set to LOB(large objects) data type. When I  run a select statement
  , this error gets thrown:</p>
  <pre><code>ERROR:
  ORA-22835: Buffer too small for CLOB to CHAR or BLOB to RAW conversion (actual: 10228,      
  maximum: 4000)
  </code></pre>
  <p>This size of the string(which are logs) inside each tuble is 10228 more than the Max capacity of the buffer. I need to fetch the entire string.</p>
  <p>I was able to come up with this temp solution:</p>
  <pre><code>Select  dbms_lob.substr( BLOB_FieldName, 4000, 1 ) 
  from Database name Where [Condition];
  </code></pre>
  <p>with this query, I was able to get the first 4000 bytes of the string, which is great, but we need the entire string.</p>
  <p>And then after reading about utl_raw.cast_to_varchar2 I tried the following</p>
  <pre><code>Select utl_raw.cast_to_varchar2( dbms_lob.substr( BLOB_fieldName, 19000, 1 ) ) 
  from[dbname];
  </code></pre>
  <p>I used  utl_raw.cast_to_varchar2 because I read somewhere online that [Varchar2] datatype can hold up to 32k byte and thought of casting [LOB] data type to Varchar2 , but it did not work.</p>
  <p>FYI,
  We are  restricted from using PL/SQL.
  Environment is linux, rhel.</p>
  <p>I need some guidance on how to go about doing this.</p>