python调用oracle存储过程
# -*- coding: utf-8 -*- import cx_Oracle conn = cx_Oracle.connect('user','pwd','tns') cursor = conn.cursor() #声明变量 #调用存储过程 sql = ''' declare result boolean; begin result := cmx_target_sql.test(o_error_message =>:o_error_message); :result := sys.diutil.bool_to_int(result); end;
'''
result= cursor.var(cx_Oracle.NUMBER)
msg=cursor.var(cx_Oracle.STRING)
args = [msg,result]
kwArgs = {}
re = cursor.execute(sql, args, **kwArgs)
conn.commit()
print(result.getvalue())
print(msg.getvalue())
cursor.close()
conn.close()
技术不行 业务不行 管理不行