title: Oracle Temporary Table to convert a Long Raw to Blob
body: <p>Questions have been asked in the past that seems to handle pieces of my full question, but I'm not finding a totally good answer.  </p>
  
  <p>Here is the situation:</p>
  
  <ul>
  <li>I'm importing data from an old, but operational and production, Oracle server.</li>
  <li>One of the columns is created as LONG RAW. </li>
  <li>I will not be able to convert the table to a BLOB.</li>
  <li>I would like to use a global temporary table to pull out data each time I call to the server.</li>
  </ul>
  
  <p>This feels like a good answer, from here: <a href="https://stackoverflow.com/questions/2671518/how-to-create-a-temporary-table-in-oracle">How to create a temporary table in Oracle</a></p>
  
  <p><code>
  CREATE GLOBAL TEMPORARY TABLE newtable
     ON COMMIT PRESERVE ROWS 
     AS SELECT 
       MYID, TO_LOB("LONGRAWDATA") "BLOBDATA"
     FROM oldtable WHERE .....;
  </code></p>
  
  <p>I do not want the table hanging around, and I'd only do a chunk of rows at a time, to pull out the old table in pieces, each time killing the table.   Is it acceptable behavior to do the CREATE, then do the SELECT, then DROP?</p>
  
  <p>Thanks..</p>
  
  <p>--- EDIT ---</p>
  
  <p>Just as a follow up, I decided to take an even different approach to this.  </p>
  
  <p>Branching the <a href="https://github.com/strongloop/strong-oracle" rel="nofollow noreferrer">strong-oracle</a> package, I was able to do what I originally hoped to do, which was to pull the data directly from the table without doing a conversion.  </p>
  
  <p><a href="https://github.com/strongloop/strong-oracle/issues/54" rel="nofollow noreferrer">Here</a> is the issue I've posted.  If I am allowed to publish my code to a branch, I'll post a follow up here for completeness.</p>
  
  <p>Oracle ODBC Driver Release 11.2.0.1.0 says that Prefetch for LONG RAW data types is supported, which is true.</p>
  
  <p>One caveat is that LONG RAW can technically be up to 2GB in size.  I had to set a hard max size of 10MB in the code, which is adequate for my use, so far at least.  This probably could be a variable sent in to the connection. </p>
  
  <p>This fix is a bit off original topic now however, but it might be useful to someone else.</p>