title: Using SQL*PLUS COPY from inside cx_Oracle?
body: <p>We need to copy records between two Oracle database schemas.</p>
  
  <p>Manually, we can do this using the SQL*PLUS COPY command:</p>
  
  <p><a href="http://www.oracleutilities.com/SQLPLus/copy.html" rel="nofollow">http://www.oracleutilities.com/SQLPLus/copy.html</a></p>
  
  <p>However, we'd like to automate this using cx_Oracle if possible (we also need to do some other things - e.g. SSH interactions, hence the use of Python and cx_Oracle).</p>
  
  <p>However, if I try to execute COPY inside cx_Oracle, it doesn't seem to like the command:</p>
  
  <pre><code>Traceback (most recent call last):
    File "&lt;stdin&gt;", line 1, in &lt;module&gt;
  cx_Oracle.DatabaseError: ORA-00900: invalid SQL statement
  </code></pre>
  
  <p>I'm guessing this is because COPY is a SQL*PLUS specific command, as opposed to part of the standard SQL spec?</p>
  
  <p>Anyhow, is there any way of getting the COPY command (or any other SQL*PLUS specific extensions) to work under cx_Oracle?</p>
  
  <p>I believe it's possible to use INSERT INTO...SELECT to achieve something similar, however that requires a database link if the two databases in question are on separate Oracle instances or hosts, and we don't always have permission to create those links.</p>
  
  <p>Cheers,
  Victor</p>