vijay shelke
vijay shelke

Reputation: 1

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                                                                                                  

Upvotes: 0

Views: 158

Answers (1)

Marmite Bomber
Marmite Bomber

Reputation: 21085

With your fstring you are sending to Oracle someting like this statement (simplified)

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.

what you probably intend is similar to following statement (not sure what you intend with the part '{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

Upvotes: 1

Related Questions