web.input fails in cx_Oracle
<p>I have a webserver and I will add the user data into my sql query. It works psycopg but not with cx_Oracle.</p>

<pre><code>...
class grid:
    def GET(self):
        web.header('Access-Control-Allow-Origin', '*')
        web.header('Access-Control-Allow-Credentials', 'true')
        web.header('Content-Type', 'application/json')

        data = web.input(ID='')
        ido = int(data.ID)
        a = [ido]

        cur = connection.cursor()
        cur.arraysize = 10000

        query = "SELECT a.id AS building_nr, c.geometry.sdo_ordinates AS geometry, d.Classname AS polygon_typ FROM   building a, THEMATIC_SURFACE b, SURFACE_GEOMETRY c, OBJECTCLASS d  WHERE   a.id = b.BUILDING_ID AND b.LOD2_MULTI_SURFACE_ID = c.ROOT_ID AND c.GEOMETRY IS NOT NULL AND b.OBJECTCLASS_ID = d.ID AND a.grid_id_500 = %s;"

        cur.execute(query, a)
</code></pre>

<p>It works until the execute statement. I get the error message:
<strong>'ascii' codec can't decode byte 0xfc in position 36: ordinal not in range(128)</strong></p>

<p>How can I add the data into my query?</p>

<p>I know what was wrong. I should not use %s for the data. Apparently, cx_Oracle defaults to a "named" paramstyle .</p>

<pre><code>data = web.input(ID='')
query = "SELECT ... FROM... WHERE a.id =:grid_id "
cursor.execute(query, {'grid_id':data.ID})
</code></pre>

python web.py cx-oracle