LosBlancoo
LosBlancoo

Reputation: 113

How to get custom object from callfunc in cx_Oracle?

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?

Upvotes: 1

Views: 718

Answers (1)

Anthony Tuininga
Anthony Tuininga

Reputation: 7086

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.

Upvotes: 1

Related Questions