title: Named Parameters in SQL Queries - cx_Oracle - ORA-01460: unimplemented or unreasonable conversion requested
body: <p>I have encountered a problem after implementing the named parameters in RAW SQL Queries as per Python DB-API.</p>
  
  <p>Earlier, my code was as follows (and this works fine, both on my DEV Server and my Client's test server)</p>
  
  <pre><code>cursor.execute("SELECT DISTINCT(TAG_STATUS) FROM TAG_HIST WHERE TAG_NBR = '%s' " %(TAG_NBR))
  </code></pre>
  
  <p>I changed it to the following</p>
  
  <pre><code>cursor.execute("SELECT DISTINCT(TAG_STATUS) FROM TAG_HIST WHERE TAG_NBR = :TAG_NBR " ,{'TAG_NBR':TAG_NBR})
  </code></pre>
  
  <p>This changed version (with named parameters) works fine on my Development Server </p>
  
  <blockquote>
    <ul>
    <li>Windows XP Oracle XE  </li>
    <li>SQL*Plus: Release 11.2.0.2.0    </li>
    <li>cx_Oracle-5.1.2-11g.win32-py2.7</li>
    </ul>
  </blockquote>
  
  <p>However, when deployed on my Client's Test Server, it does not.... execution of all queries fail.</p>
  
  <p>Characteristics of my client's server are as follows</p>
  
  <ul>
  <li>Windows Server 2003</li>
  <li>Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bi</li>
  <li>cx_Oracle-5.1.2-10g.win32-py2.7</li>
  </ul>
  
  <p>The error that I get is as follows</p>
  
  <pre><code>Traceback (most recent call last):
    File "C:/Program Files/App_Logic/..\apps\views.py", line 400, in regularize_TAG
      T_cursor.execute("SELECT DISTINCT(TAG_STATUS) FROM TAG_HIST WHERE TAG_NBR = :TAG_NBR " ,{'TAG_NBR':TAG_NBR})
  DatabaseError: ORA-01460: unimplemented or unreasonable conversion requested
  </code></pre>
  
  <p>Appreciate if someone could help me through this issue.</p>
  
  <p>This issue presents itself only when the cx_Oracle code is run inside the Web App (Hosted on Apache).</p>
  
  <p>If i run the same code with named parameters from within the python command line then the query runs just fine.</p>