I am getting the error cx_Oracle.DatabaseError: ORA-00933: SQL command not properly ended when trying to run the following code. I have used
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()
Running the following works as expected:
conn = cx_Oracle.connect('username', 'password', dsn_tns)
print (conn.version)
conn.close()
asked Nov 17, 2017 at 11:37
Morgoth
5,2148 gold badges46 silver badges71 bronze badges
1 Answer 1
You don't need the semicolon at the end of the query, maybe it has something to do with that
answered Nov 17, 2017 at 11:42
Arjen Dijkstra
1,57918 silver badges25 bronze badges
Sign up to request clarification or add additional context in comments.
2 Comments
alex
Can you explain why not?
Arjen Dijkstra
@christopher-jones explained it very nice in the comments of the question.
lang-py
ORA-00933: SQL command not properly endedin all cases.