DB API question - where is a stored procedure's return value?
Ian Kelly
ian.g.kelly at gmail.com
Wed Mar 12 19:00:12 EDT 2014
On Wed, Mar 12, 2014 at 3:44 PM, Skip Montanaro <skip at pobox.com> wrote:
> What do other database adaptors do about stored procedure return
> values? Does PEP 249 need revision?
I can't speak generally, but in cx_Oracle you either execute a query like this:
result = cursor.var(cx_Oracle.NUMBER)
cursor.execute(":1 := test_proc()", [result])
print(result.getvalue())
or you use the non-standard callfunc method:
print(cursor.callfunc("test_proc", cx_Oracle.NUMBER))
As a general solution, one might wrap a stored procedure that returns
a value into a stored procedure that has an output parameter and call
it with callproc. Some implementations might include a return value
in the parameter list anyway.
More information about the Python-list
mailing list