Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/oop/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
我在python代码中执行更新查询时遇到此错误_Python_Oracle_Cx Oracle - Fatal编程技术网

我在python代码中执行更新查询时遇到此错误

我在python代码中执行更新查询时遇到此错误,python,oracle,cx-oracle,Python,Oracle,Cx Oracle,代码:- upd=(f"update order_tb set ('name=:{self.name.get()}','contact=:{self.contact.get()}','address=:{self.address.get()}','store=:{self.combo_store.get()}','groceries=:{self.groceries.get()}','{O_ID}',where o_id=:O_ID") cur.execute(upd)

代码:-

upd=(f"update order_tb set ('name=:{self.name.get()}','contact=:{self.contact.get()}','address=:{self.address.get()}','store=:{self.combo_store.get()}','groceries=:{self.groceries.get()}','{O_ID}',where o_id=:O_ID")
cur.execute(upd) 
错误:-

cx_Oracle.DatabaseError: ORA-01747: invalid user.table.column, table.column, or column specification                                                                                                  

使用
f
字符串向Oracle发送类似以下语句的内容(简化)

这确实会导致
SQL错误:ORA-01747:无效的user.table.column、table.column或column规范
,因为您完全违反了有效的
更新
语法

您可能想要的类似于下面的语句(不确定您想要对部件
'{O_ID}'
做什么)


因此,generall建议在执行之前打印
UPDATE
语句并检查语法

您应该修改问题标题以反映所问的问题。“我有x个错误”不会问任何问题,也不会提供任何有关错误的信息。这将有助于相关人士找到问题所在。类似于“ORA-01747在Oracle中尝试在python代码中执行更新查询”这样的内容,这是否回答了您的问题?尝试在cur.execute(upd)之前打印upd,并检查语句的语法是否正确,我指的是表名、列名。。。如果有多余的性格。
update order_tb set ('name=:X1','contact=:X2','address=:X3','store=:X4','groceries=:X5','o_id',where o_id=:O_ID 
update order_tb set  name=:X1, contact=:X2, address=:X3, 
                     store=:X4, groceries=:X5 
where o_id=:O_ID