title: Executing script by using function callproc from cx_Oracle module in python 2.7.5
body: <p>I'm relatively new to Python.
  I'm currently working on SQL statement execution in Oracle DB.</p>
  
  <p>When I execute query:</p>
  
  <pre><code>query = 'select * from table' 
  cursor.execute(query)
  result = cursor.fetchall()
  </code></pre>
  
  <p>everything is going fine, but when I try to execute script:</p>
  
  <p>script in plain text:</p>
  
  <pre><code>begin
   SIEBEL_DBA.X_DR_DEPLOY(id =&gt; '1-4NANEI', env_code =&gt; 'SVE_SIT');
  end;
  /
  </code></pre>
  
  <p>code from script</p>
  
  <pre><code>script = "begin\nSIEBEL_DBA.X_DR_DEPLOY(id =&gt; '1-4NANEI', env_code =&gt; 'SVE_SIT');\nend;"
  cursor.execute(script)
  
  result = cursor.fetchall()
  </code></pre>
  
  <p>I get an exception, that this is not a query, but still this script has worked.</p>
  
  <p>So from what I've googled, looks like I should use callproc function:</p>
  
  <pre><code>cursor.callproc['SIEBEL_DBA.X_DR_DEPLOY',{'id' : '1-4NANEI', 'env_code' : 'SVE_SIT'}]
  connection.commit()
  
  result = cursor.fetchall()
  </code></pre>
  
  <p>When I'm executing this statement, I'm also getting exception, but this time nothing has been changed in DB:</p>
  
  <p>'builtin_function_or_method' object has no attribute '<strong>getitem</strong>'</p>
  
  <p>Could someone please point where I'm not correct and how should I modify statement so it would be working.</p>
  
  <p>Huge thanks in advance!</p>
  
  <p>RESOLUTION:</p>
  
  <p>I was frustrated by the syntax and the complexity of callproc and callfunc functions.
  I've found good resource: <a href="http://dbaportal.eu/sidekicks/sidekick-cx_oracle-code-paterns/#part1" rel="noreferrer">http://dbaportal.eu/sidekicks/sidekick-cx_oracle-code-paterns/#part1</a>
  in this link I found all needed info and examples on how to work with cx_Oracle library.</p>
  
  <p>at the end I just needed to modify a bit my code:</p>
  
  <pre><code>cursor.callproc('SIEBEL_DBA.X_DR_DEPLOY', ['1-4NANEI', 'SVE_SIT'])
  </code></pre>
  
  <p>and the needed part was done, I didn't need to specify any return type, as script that I'm executing doesn't return any value, it just sets it.</p>