Re: [cx-oracle-users] How is cursor.callfunc() supposed to work?
Brought to you by:
atuining
From: James C. M. <Jam...@or...> - 2012-02-22 11:33:12
|
Hi Paul, On 22/02/12 05:44 PM, James C. McPherson wrote: > On 22/02/12 05:40 PM, Paul Moore wrote: ... >>> From this code, it appears the api call is a procedure, rather than a >>> function (no return value). The cursor.callfunc method won't work for >>> procedures, I suspect (no return type - you appear to have used >>> cx_Oracle.NUMBER in your tests, for some reason...). So I'd suggest >>> that you need to stick with the execute of a block solution. >> >> ... or use cursor.callproc, which I just noticed :-) > > Hmmm. I thought it was declared as a function but on > re-reading the 1page snipped that is its documentation > I see in bold type "Procedure". Well ... waddayaknow .... after mucking around for a bit (restarting my python shell to clean out some extraneous bind variables and paying attention to the returned message when I got the args wrong) it works! Id= 13741059 comments= "new comment to enter" commenttype= 'N' error_code = 0 error_mesg = cursor.var(cx_Oracle.STRING) keywordargs={ID : Id, 'comments' : comments, 'commenttype' : 'N', 'error_code' : error_code, 'error_mesg' : error_mesg } rval = cursor.callproc('bug.bug_api.create_bug_line', [], keywordargs) >>> if rval.__contains__("Text line inserted successfully on %d" % Id): ... print "hey, it worked!" ... else: ... print "boooo" ... hey, it worked! :-D Thankyou for your help with this problem. James C. McPherson -- Oracle http://www.jmcp.homeunix.com/blog |