dbmsoutput

This commit is contained in:
Josue Gomez 2019-03-28 13:05:29 -06:00
parent 70223b9cd3
commit 4a53bf76f3

View File

@ -6,6 +6,23 @@ APP_CTX_ENTRIES = [
]
def dbmsoutput(cursor):
"""
dbmsoutput must be enabled before execute statement
cur.callproc("dbms_output.enable",(None,))
"""
output = str()
status = cursor.var(cx_Oracle.NUMBER)
dbmsline = cursor.var(cx_Oracle.STRING)
while True:
cursor.callproc("dbms_output.get_line", (dbmsline, status))
if status.getvalue():
break
output += f'{dbmsline.getvalue()} \n'
return output
class OraConn(cx_Oracle.Connection):
# instance can return a cursor or the whole conn
def __init__(self, str_conn, ret="conn", module_name=None):