how to use cx_Oracle callfunc

Godzilla godzillaismad at gmail.com
Fri May 11 00:18:31 EDT 2007


On May 11, 11:51 am, Godzilla <godzillais... at gmail.com> wrote:
> Hi all,
>
> I need to know how to use the method callfunc in cx_Oracle. I am
> trying to get a primary key after an insert via a function call, but I
> do not know how to pass the return value from the function via the
> callfunc method. Can anyone help?
>
> I also tried the execute(), and callproc(), but to no avail. My
> function is as below:
>
> create or replace function addRow(desc table1.col1%type) return number
> is id number;
> begin
>   insert into table1 (description) values (desc) returning table1ID
> into id;
>   return(id);
>   exception
>     when others then return(-1)
> end;
>
> The code in the callfunc:
>
> cur.callfunc("addRow", returnType, param)
>
> Question is:
> - What is returnType and how to I declare that before passing into the
> function?
> - How do I define the parameters?
>
> I tried the setinputsizes and setoutputsize, but I keep getting errors
> saying the parameter is incorrectly defined. Please help. Thank.

Hello,

found a solution in another thread... see

http://groups.google.com/group/comp.lang.python/browse_thread/thread/ab13d3364aafdd28/4ca1fde2069ff3da?lnk=st&q=cx_oracle+how+to+setinputsizes&rnum=9&hl=en#4ca1fde2069ff3da

for more info.

Thanks.




More information about the Python-list mailing list