cx_Oracle.DatabaseError: ORA-00933: SQL command not properly ended

cx_Oracle.DatabaseError: ORA-00933: SQL command not properly ended

我在尝试 运行 以下代码时遇到错误 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()

查询末尾不需要分号,可能与此有关