[英]I am getting this error while executing update query in python code
code:-代码:-
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)
error:-错误:-
cx_Oracle.DatabaseError: ORA-01747: invalid user.table.column, table.column, or column specification
With your f
string you are sending to Oracle someting like this statement (simplified)使用您的f
字符串,您将发送到 Oracle 类似此语句的内容(简化)
update order_tb set ('name=:X1','contact=:X2','address=:X3','store=:X4','groceries=:X5','o_id',where o_id=:O_ID
Which indeed leads to SQL Error: ORA-01747: invalid user.table.column, table.column, or column specification
as you completely violates the valid UPDATE
syntax.这确实会导致SQL Error: ORA-01747: invalid user.table.column, table.column, or column specification
因为您完全违反了有效的UPDATE
语法。
what you probably intend is similar to following statement (not sure what you intend with the part '{O_ID}'
)您可能打算的内容类似于以下语句(不确定您对'{O_ID}'
部分'{O_ID}'
)
update order_tb set name=:X1, contact=:X2, address=:X3,
store=:X4, groceries=:X5
where o_id=:O_ID
So the generall advice is print the UPDATE
statement before you execute it and check the syntax所以一般建议是在执行之前打印UPDATE
语句并检查语法
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.