[cx-oracle-users] How is cursor.callfunc() supposed to work?
Brought to you by:
atuining
From: James C. M. <Jam...@or...> - 2012-02-22 06:08:01
|
Hi everybody, I'm migrating a collection of python scripts from one db (Oracle backend, but we get to use some Siebel middleware) to another (raw Oracle 11g). I've been trying to use the cursor.callfunc() method with one of the API calls that we're allowed to use, but no matter what variation of arguments I supply, I just cannot get the method to work. cursor.callfunc('package.api.functionname', cx_Oracle.NUMBER, [], { \ 'ID' : 13741059, 'comments' : 'Fixed in rev:csetid', 'commenttype' : 'N', 'opaqueid' : 'NULL', 'error_code' : 0, 'error_mesg' : 'NULL'} ) This would fail with Traceback (most recent call last): File "<stdin>", line 1, in <module> cx_Oracle.DatabaseError: ORA-06550: line 1, column 13: PLS-00306: wrong number or types of arguments in call to 'FUNCTIONNAME' ORA-06550: line 1, column 7: PL/SQL: Statement ignored The same issue occured when I used positional params instead of keyword params. Yes, I have checked and rechecked that I am supplying all the args to the function which are mandatory, as well as those which are merely optional. I also found Anthony's post from 2002 (http://mail.python.org/pipermail/python-list/2002-September/788482.html) which mentions setinputsizes(), and tried using that route as well. No joy there either I eventually fell back to using a Statement ala cursor.execute(""" DECLARE outnum NUMBER; outmsg VARCHAR2(5000); BEGIN package.api.functionname( ID => 13741059, comments => 'Fixed in changeset: 14209:585efc418ca7', commenttype => 'N', opaqueid => NULL, error_code => bugoutnum, error_mesg => bugoutmsg); END; """) connection.commit() ... which worked. So ... should I try to use cursor.callfunc() in the future, or just stick with statements like the above? I'm using cx_Oracle 5.1.1, Oracle Instant Client 11.2, running with python2.6 on Solaris 11. Pointers to where (and how) I misread the docs would be greatly appreciated. Thankyou in advance, James C. McPherson -- Oracle http://www.jmcp.homeunix.com/blog |