I'm trying to get a certain value from an oracle database and print a string with the value of the oracle database query.
con=cx_Oracle.connect('username/pword')
cur=con.cursor()
fList=()
obj=cur.execute('''select sequence from genes where key=54321''')
cur.close()
con.close()
print str(obj)
I get this output:
<cx_Oracle.Cursor on <cx_Oracle.Connection to user hendrik@local>>
But I'd like to get the value of sequence for this unique key/row.
objis a python generator object. You can loop through it (for item in obj:) to retrieve the results of the query. Or it you only want one result:item = obj[0]