dbmsoutput
This commit is contained in:
parent
70223b9cd3
commit
4a53bf76f3
17
oracle.py
17
oracle.py
@ -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):
|
||||
|
||||
Loading…
Reference in New Issue
Block a user