Khw*_*ien 2 python cx-oracle oracle11gr2
我是cx_oracle的新手.我已建立连接,我可以使用execute创建和删除表.
我失败的地方是当我尝试在执行中使用"INSERT INTO ..."时.它没有显示任何错误,但它也没有存储任何值(我通过检查条目是否使用shell中的sqlplus进行确认).我使用的代码是:
table_name = "T1"
column = "D"
insert_value = "test value"
sqlcode = "INSERT INTO "+table_name+" ("+column+") VALUES ('"+insert_value+"')"
cursor.execute(sqlcode)
Run Code Online (Sandbox Code Playgroud)
请帮助我,任何帮助将不胜感激.
提前致谢.Ĵ
cursor.commit当Cursor中的方法没有提交时,如何工作,连接有这个方法,因此它应该是:
connection.commit()
Run Code Online (Sandbox Code Playgroud)
使用cursor.commit()回报:
AttributeError: 'cx_Oracle.Cursor' object has no attribute 'commit'