cx_Oracle.DatabaseError:ORA-00933:SQL命令未正确结束

时间:2017-11-17 11:37:09

标签: python cx-oracle

尝试运行以下代码时出现错误cx_Oracle.DatabaseError: ORA-00933: SQL command not properly ended。我用过

import cx_Oracle
ip = '127.0.0.1'
port = 1234
SID = 'abcd'
dsn_tns = cx_Oracle.makedsn(ip, port, SID)

conn = cx_Oracle.connect('username', 'password', dsn_tns)
curs = conn.cursor()
curs.execute('select sysdate from dual;')  # Error is here
curs.close()
conn.close()

按预期运行以下工作:

conn = cx_Oracle.connect('username', 'password', dsn_tns)
print (conn.version)
conn.close()

1 个答案:

答案 0 :(得分:7)

您不需要在查询结尾处使用分号,也许它与该内容有关