我正在尝试使用cx_Oracle,但它似乎不喜欢我对db-api的了解。
这些陈述起作用:
cur.execute('INSERT INTO "testdboz" ("id", "sessionid") VALUES (2, 123)')
cur.execute('INSERT INTO "testdboz" ("id", "sessionid") VALUES (:id, :sid)',
{'id':1, 'sid':13})
cur.execute('INSERT INTO "testdboz" ("id", "sessionid") VALUES (:1, :2)', [1123, 123])
然而,这失败了:
cur.execute('INSERT INTO "testdboz" ("id", "sessionid") VALUES (?, ?)', [1, 123])
上述内容失败了:
---------------------------------------------------------------------------
DatabaseError Traceback (most recent call last)
<ipython-input-17-4e9fe350f968> in <module>()
----> 1 cur.execute('INSERT INTO "testdboz" ("id", "sessionid") VALUES (?, ?)', [1, 123])
DatabaseError: ORA-01036: illegal variable name/number
有没有办法纠正这个陈述? cx_Oracle
是否支持qmark
?