How to get custom object from callfunc in cx_Oracle?

我们两清 提交于 2019-12-24 07:35:30

问题


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),
)  

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.

Is it even possible to get custom definded object by calling PL/SQL function? Or maybe there is another way to get it?


回答1:


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.



来源:https://stackoverflow.com/questions/40105683/how-to-get-custom-object-from-callfunc-in-cx-oracle

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!