[英]Python cx_Oracle prepared statement with qmark
I am trying to work with cx_Oracle, but it seems to dislike what I know about db-api. 我正在尝试使用cx_Oracle,但似乎不喜欢我对db-api的了解。
These statement work: 这些语句起作用:
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])
However, this fails: 但是,这失败了:
cur.execute('INSERT INTO "testdboz" ("id", "sessionid") VALUES (?, ?)', [1, 123])
The above fails with: 上面的失败与:
---------------------------------------------------------------------------
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
Is there a way to correct this statement? 有没有办法纠正这个说法? Does
cx_Oracle
suppprt qmark
? cx_Oracle
是否支持qmark
?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.