title: Pre-pending and appending to a shell variable
body: <p>My goal is to load an external tables log file into a CLOB column in an oracle database. I've been having issues with the max size you can insert at once but I am able to insert the whole file if I to_clob each line of the log file, concatenate and then insert them (as far as I'm aware this seems to be the quickest and easiest way?): </p>
  
  <pre><code> insert into clob_insert_test values (to_clob('hfsdjhfjsdhfjksd')||chr(10)||to_clob('jhfklsdjfklsdjklfjdsjlk'));
  </code></pre>
  
  <p>My question is: 
  I'm reading the file into a shell variable as below so what I need to do is pre-pend <strong>to_clob('</strong> to the beginning of each line of the variable and then append <strong>')||chr(10)||</strong> and remove the last <strong>||chr(10)||</strong> from the variable to finish. I can then use that variable in the SQL insert statement for the clob column. Is there a way I can directly do this on the variable rather than modifying the log file before reading it in?</p>
  
  <pre><code>log_content=$(&lt;"$log_file")
  </code></pre>
  
  <p>Edit: </p>
  
  <p>Sorry I don't think I was clear. Given the example log file I would expect the following variable contents. </p>
  
  <p>Input file:</p>
  
  <pre><code>LOG file opened at 05/05/15 15:12:24
  
  Field Definitions for table ext_loading
  Record format DELIMITED BY NEWLINE
  </code></pre>
  
  <p>Variable contents:</p>
  
  <pre><code>to_clob('LOG file opened at 05/05/15 15:12:24')||char(10)||to_clob('Field Definitions for table ext_loading')||char(10)||to_clob('Record format DELIMITED BY NEWLINE')
  </code></pre>