You can use the following technique which works with both callfunc()
and callproc():
# this creates a bind variable of type string of length 4000
outStringVar = cursor.var(cx_Oracle.STRING)
# bind the new variable into the function call
result = cursor.callfunc("GetStuff", cx_Oracle.NUMBER,
(number1, number2, outStringVar))
# get the result from the bind variable after the function has succeeded
outString = outStringVar.getvalue()
Hopefully this makes sense to you. :-)
On Thu, 17 Mar 2005 09:30:51 -0000, Nik Barron
<Nik...@pe...> wrote:
> Hi,
>
> I have an Oracle function that has an output parameter, e.g.
>
> GetStuff(number1, number2, outstring)
>
> where outstring is a VARCHAR2. The funtion returns an error code, or 0 for
> success in which case the data is in outstring.
>
> When calling this via cx_Oracle's callfunc(), I get the return code but no
> data in outstring. Looking at the docs I suspect this is expected behaviour;
> previously I've only dealt with input/output parameters with callproc()
> which works fine.
>
> Should callfunc() be populating outstring or do I need to get our Oracle
> guys to rewrite the functions as procedures and use callproc()?
>
> Many thanks,
>
> Nik
>
> -------------------------------------------------------
> SF email is sponsored by - The IT Product Guide
> Read honest & candid reviews on hundreds of IT Products from real users.
> Discover which products truly live up to the hype. Start reading now.
> http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
> _______________________________________________
> cx-oracle-users mailing list
> cx-...@li...
> https://lists.sourceforge.net/lists/listinfo/cx-oracle-users
>
|