473,398 Members | 2,088 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

how to use cx_Oracle callfunc

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.

May 11 '07 #1
1 7053
On May 11, 11:51 am, Godzilla <godzillais...@gmail.comwrote:
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....a1fde2069ff3da

for more info.

Thanks.

May 11 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: GrayGeek | last post by:
After cx_Oracle and the related Oracle tools for Python 2.2.3 + Boa-constructor on Win2000, I added "import cx_Oracle" to the top of a test script. It gives me an error about being unable to find...
8
by: Rodrigo Daunaravicius | last post by:
I can't get this configuration working: cx_Oracle 4.0.1 Oracle 8.0.6 Python 2.3.3 Win NT4.0 SP6fc My first shot at the problem was just running the installation thingie pre-built for...
1
by: Greg Lindstrom | last post by:
>Shouldn't this be '/u01/app/oracle/product/9.2.0' ? Based on the following values, that's what I'd expect. I changed the ORCALE_HOME environment variable to the above suggested value and got a...
1
by: jmdeschamps | last post by:
Hello Having cx_Oracle (an Oracle database connector for Python) used it here where I teach for the last couple of years, and finding it so easy to use (and install) I was taken aback when I got...
4
by: infidel | last post by:
I have a stored procedure that has a single output parameter. Why do I have to pass it a string big enough to hold the value it is to receive? Why can't I pass an empty string or None? >>>...
7
by: Carl K | last post by:
I am trying to use this: http://python.net/crew/atuining/cx_Oracle/html/cx_Oracle.html it is a real module, right? sudo easy_install cx_Oracle did not easy_install cx_Oracle. ...
1
by: Lukas Ziegler | last post by:
Hi, I want to get an access to an oracle database. For that I found the module cx_oracle (http://www.python.net/crew/atuining/cx_Oracle/) and I have installed the version 'Windows Installer...
2
by: Glich | last post by:
"""Hi, how can I extend the code shown below so that I can identify any "CallFunc" in "func.code" and identify the value of "node" in "CallFunc"? Thanks. This is my code so far: """ """...
3
by: Benjamin Hell | last post by:
Hi! I have a problem with the cx_Oracle module (Oracle database access): On a computer with cx_Oracle version 4.1 (Python 2.4.3, Oracle 10g) I can get query results consisting of strings...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.