After doing lots of searching on the Internet for how to get the dbms_output from an Oracle SQL query with Python I finally found something.
import cx_Oracle conn = cx_Oracle.Connection("userid/password@tns") curs = conn.cursor() curs.callproc("dbms_output.enable") sqlCode = """ some long sql code with dbms_output """ curs.execute(sqlCode) statusVar = curs.var(cx_Oracle.NUMBER) lineVar = curs.var(cx_Oracle.STRING) while True: curs.callproc("dbms_output.get_line", (lineVar, statusVar)) if statusVar.getvalue() != 0: break print lineVar.getvalue()
by _neo_
24 Nov 2010 at 23:19
Thank you very much, Terry Moore!!!