如何从cx_Oracle中的callfunc获取自定义对象? [英] How to get custom object from callfunc in cx_Oracle?
问题描述
我有一个PL/SQL函数 my_function
,该函数返回自定义对象:
I have an PL/SQL function my_function
that returns custom defined object:
CREATE OR REPLACE TYPE "TP_ACTION" AS OBJECT
(
stop_time timestamp,
user_name varchar2(64),
error_msg tp_message_l,
CONSTRUCTOR FUNCTION TP_ACTION(
usrnm in varchar2 := null
) RETURN SELF AS RESULT,
MEMBER PROCEDURE doClose(pi_session_MD5 IN VARCHAR2),
member procedure setRunStatus(status in varchar2),
)
因此,在python中,我将该函数称为:
Therefore in python I call that function:
var_type = cursor.var(cx_Oracle.OBJECT, typename='TP_ACTION')
cursor.callfunc('my_function', var_type, params)
在那之后我得到了异常:
After that I get exception:
cx_Oracle.NotSupportedError: Variable_TypeByPythonType(): unhandled data type.
是否有可能通过调用PL/SQL函数获得自定义对象?也许还有另一种方式来获得它?
Is it even possible to get custom definded object by calling PL/SQL function? Or maybe there is another way to get it?
推荐答案
绑定Oracle对象的功能仅在未发行(开发)的cx_Oracle版本中可用.这是调用返回对象的函数所必需的.如果您可以使用开发版本,则您的代码将起作用;否则,请等待正式发布.
The ability to bind Oracle objects is only available in the unreleased (development) version of cx_Oracle. This is needed for calling a function that returns an object. If you can make use of the development version your code will work; otherwise, please wait for the official release.
这篇关于如何从cx_Oracle中的callfunc获取自定义对象?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!