以前也有人问过类似的问题,但我仍然无法找到解决办法。我的代码:try:
connection = cx_Oracle.connect(ORACLE_CONNECT)
logger.info("Connection to Oracle success.")
print ("Oracle DB version: " + connection.version)
print ("Oracle client encoding: " + connection.encoding)
print ("Python version: " + platform.python_version())
except cx_Oracle.DatabaseError as e:
error, = e.args
if error.code == 1017:
print ("Username/password invalid.")
logger.debug("Username/password invalid: %s", error.code)
else:
logger.debug("Database connection error: %s", e)
print ("Database connection error: %s".format(e))
raise
cursor = connection.cursor()
smsreport_text_new = tuple(smsreport_text)
find_command = self.identify_unique_msgid(smsreport_list)
cursor.execute(find_command)
def identify_unique_msgid(self, smsreport_list):
msgid_i_to_be_crosschecked = smsreport_list.get('msgid_i')
msgid_ii_to_be_crosschecked = smsreport_list.get('msgid_ii')
find_command = 'SELECT * FROM myTable WHERE msgid_i = {0}'.format(msgid_i_to_be_crosschecked)
print (find_command)
return find_command
find_command如下所示:
^{pr2}$
我尝试过在SQL查询的末尾加上或不加分号,但还是失败了。我知道连接是有效的,因为我有另一个查询(见下文),这会将数据写入表中。当我试图查找包含某些值的行时,我得到了这个错误消息。在insert into xura_push (date_sms, result_sms, msgid, msgparts, msgid_i, msgid_ii) values (TO_DATE(:1, 'dd-mon-yyyy hh24:mi:ss'), :2, :3, :4, :5, :6)
我哪里出错了?在
干杯,皮马特。在