MySQL Forums
Forum List  »  Connector/Python

Lpad not supporting %s in Python
Posted by: Jay Sardhara
Date: July 31, 2017 01:05PM

Hi,

I am trying to query:
cursor.execute("Select Lpad (%s,5,0)", (24))

which results in error:
mysql.connector.errors.ProgrammingError: 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '%s,5,0)' at line 1

Same query executes successfully as:
cursor.execute("Select Lpad (24,5,0)")

Platform: Windows
Lib. Build: mysql-connector-python-2.1.6-py2.7-winx64
Python: 2.7.13

Options: ReplyQuote


Subject
Written By
Posted
Lpad not supporting %s in Python
July 31, 2017 01:05PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.