[cx-oracle-users] callfunc of a PL/SQL function returning REF CURSOR does not work
Brought to you by:
atuining
From: Steinmann D. <Dan...@co...> - 2006-08-09 21:10:37
|
Hello, I would like to call a PL/SQL function which returns a REF CURSOR (see attached PL/SQL code) with following Python statements connection =3D cx_Oracle.connect('test/test') statement =3D connection.cursor() result =3D statement.callfunc("my_pack.my_func_cursor", cx_Oracle.CURSOR, (5)) for row in result: print "Row:", row =20 This aborts like this: Traceback (most recent call last): File "./x.py", line 12, in ? statement.callfunc("my_pack.my_func_cursor", cx_Oracle.CURSOR, (5)) cx_Oracle.NotSupportedError: Variable_TypeByPythonType(): unhandled data type I guess this happens because the function Variable_TypeByPythonType in Variable.c does not handle the CURSOR type. The REF CURSOR type is supported as in out parameter of a stored procedure (see http://permalink.gmane.org/gmane.comp.python.db/1413 ) Is there any reason why REF CURSOR is not supported as return value of a stored function? Thanks, Daniel P.S.: I'm using cx_Oracle-4.2, Oracle 10.2, Python 2.4.3, Solaris 2.9. --- CREATE OR REPLACE PACKAGE my_pack IS TYPE my_ref_cursor IS REF CURSOR; FUNCTION my_func_cursor(some_number IN NUMBER) RETURN my_ref_cursor; END; / show errors CREATE OR REPLACE PACKAGE BODY my_pack IS FUNCTION my_func_cursor(some_number IN NUMBER) RETURN my_ref_cursor IS result my_ref_cursor; BEGIN OPEN result FOR SELECT some_number AS col1, some_number * 10 AS col2 FROM DUAL; RETURN result; END; END; / show errors |