472,965 Members | 1,908 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

cx_Oracle + array parameter

Hello,

I'm trying to pass array as an argument into PL/SQL procedure.
According to cursor manual (http://cx-oracle.sourceforge.net/html/
cursorobj.html) arrayvar() should be use to do it. I've created my
array type in PL/SQL:

CREATE OR REPLACE TYPE cx_array_string is table of varchar2(200);

and simple procedure:

CREATE OR REPLACE PROCEDURE text(ret IN cx_array_string) IS
BEGIN
null;
END text;

My python code:

p_array = curs.arrayvar(cx_Oracle.STRING, ['1','3'])
curs.execute('BEGIN text( :1 ); end;', [p_array] )

And it gives me back an error:
cx_Oracle.DatabaseError: ORA-06550: line 1, column 7:
PLS-00306: wrong number or types of arguments in call to 'TEXT'
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored

It's the same when i try to use callproc() instead of execute(). I've
searched whole internet with no luck. Could anyone please give me a
working example python + pl/sql how to pass string array form py to
oracle procedure, please.

Thank you!
Dec 3 '07 #1
3 8341
lu********@gmail.com wrote:
Hello,

I'm trying to pass array as an argument into PL/SQL procedure.
According to cursor manual (http://cx-oracle.sourceforge.net/html/
cursorobj.html) arrayvar() should be use to do it. I've created my
array type in PL/SQL:

CREATE OR REPLACE TYPE cx_array_string is table of varchar2(200);

and simple procedure:

CREATE OR REPLACE PROCEDURE text(ret IN cx_array_string) IS
BEGIN
null;
END text;

My python code:

p_array = curs.arrayvar(cx_Oracle.STRING, ['1','3'])
curs.execute('BEGIN text( :1 ); end;', [p_array] )

And it gives me back an error:
cx_Oracle.DatabaseError: ORA-06550: line 1, column 7:
PLS-00306: wrong number or types of arguments in call to 'TEXT'
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored

It's the same when i try to use callproc() instead of execute(). I've
searched whole internet with no luck. Could anyone please give me a
working example python + pl/sql how to pass string array form py to
oracle procedure, please.

Thank you!
First off I've never used cxOracle or done any PL/SQL from python, but
it looks like you're passing a list of a list to text().
p_array = curs.arrayvar(cx_Oracle.STRING, ['1','3'])
curs.execute('BEGIN text( :1 ); end;', [p_array] )
p_array appears to be some sort of cxOracle array, but when you pass it
to curs.execute you wrap it in a new list: [p_array]. Try removing the
parens and see what happens.

Ian

Dec 3 '07 #2
On 3 Gru, 19:07, Ian Clark <icl...@mail.ewu.eduwrote:
lukasz....@gmail.com wrote:
Hello,
I'm trying to pass array as an argument into PL/SQL procedure.
According to cursor manual (http://cx-oracle.sourceforge.net/html/
cursorobj.html) arrayvar() should be use to do it. I've created my
array type in PL/SQL:
CREATE OR REPLACE TYPE cx_array_string is table of varchar2(200);
and simple procedure:
CREATE OR REPLACE PROCEDURE text(ret IN cx_array_string) IS
BEGIN
null;
END text;
My python code:
p_array = curs.arrayvar(cx_Oracle.STRING, ['1','3'])
curs.execute('BEGIN text( :1 ); end;', [p_array] )
And it gives me back an error:
cx_Oracle.DatabaseError: ORA-06550: line 1, column 7:
PLS-00306: wrong number or types of arguments in call to 'TEXT'
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored
It's the same when i try to use callproc() instead of execute(). I've
searched whole internet with no luck. Could anyone please give me a
working example python + pl/sql how to pass string array form py to
oracle procedure, please.
Thank you!

First off I've never used cxOracle or done any PL/SQL from python, but
it looks like you're passing a list of a list to text().
p_array = curs.arrayvar(cx_Oracle.STRING, ['1','3'])
curs.execute('BEGIN text( :1 ); end;', [p_array] )

p_array appears to be some sort of cxOracle array, but when you pass it
to curs.execute you wrap it in a new list: [p_array]. Try removing the
parens and see what happens.

Ian
Hello,

Thanks for your reply. The secound parameter in curs.execute have to
be list. I passed only one parameter so it looks bizzare but this is
right.
Anyway i know why it was wrong. Problem is in the cx_array_string.
This type has to be INDEX BY BINARY_INTEGER !!!! I hope it will help
somebody in the future.
Dec 3 '07 #3
On 3 Gru, 19:07, Ian Clark <icl...@mail.ewu.eduwrote:
lukasz....@gmail.com wrote:
Hello,
I'm trying to pass array as an argument into PL/SQL procedure.
According to cursor manual (http://cx-oracle.sourceforge.net/html/
cursorobj.html) arrayvar() should be use to do it. I've created my
array type in PL/SQL:
CREATE OR REPLACE TYPE cx_array_string is table of varchar2(200);
and simple procedure:
CREATE OR REPLACE PROCEDURE text(ret IN cx_array_string) IS
BEGIN
null;
END text;
My python code:
p_array = curs.arrayvar(cx_Oracle.STRING, ['1','3'])
curs.execute('BEGIN text( :1 ); end;', [p_array] )
And it gives me back an error:
cx_Oracle.DatabaseError: ORA-06550: line 1, column 7:
PLS-00306: wrong number or types of arguments in call to 'TEXT'
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored
It's the same when i try to use callproc() instead of execute(). I've
searched whole internet with no luck. Could anyone please give me a
working example python + pl/sql how to pass string array form py to
oracle procedure, please.
Thank you!

First off I've never used cxOracle or done any PL/SQL from python, but
it looks like you're passing a list of a list to text().
p_array = curs.arrayvar(cx_Oracle.STRING, ['1','3'])
curs.execute('BEGIN text( :1 ); end;', [p_array] )

p_array appears to be some sort of cxOracle array, but when you pass it
to curs.execute you wrap it in a new list: [p_array]. Try removing the
parens and see what happens.

Ian

Hello,

Thanks for your reply. The secound parameter in curs.execute has to be
list. I passed only one parameter so it looks bizzare but this is
right.
Anyway i know why it was wrong. Problem is in the cx_array_string.
This type has to be INDEX BY BINARY_INTEGER !!!! I hope it will help
somebody in the future.
Dec 3 '07 #4

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

Similar topics

12
by: Kristian Bisgaard Lassen | last post by:
Hi, How do I parameterize a template by a a allocated array of integers, which is declared static and constant, so I can make compile time optimizations depending on the content of the array....
6
by: Dylan Nicholson | last post by:
Is there any way of declaring the parameter "array" below to be const, so that the function as written will not compile: void foo(int array /*const*/) { array = array; // should not be allowed...
5
by: - | last post by:
since mysql's stored procedure does not accept an array as a parameter, is it a good practice to input a string delimited parameter eg. call stored_procedure(param1, param2,...
4
by: Chris Kettenbach | last post by:
Has anyone had any success passing an adArray arg to a command object parameter for an IN Clause? As in "SELECT * FROM tmp1 WHERE MyID IN ?" I successfully open the connection object, and I can...
2
by: Fredrik Strandberg | last post by:
I have not been able to find the solution of this problem anywhere: I am building a class PrivateHelper that provides methods to access private members and invoke private methods, to be used for...
3
by: TC | last post by:
I just upgraded some code to VB 2005. When I did so, Visual Studio generated several warnings telling me about things which weren't quite perfect in my code. I resolved all the warnings except one....
7
by: steveyjg | last post by:
This is my first post so I'm not sure if this should be in the .NET forum or the VB forum. Anyway I'm using VB .NET and trying to call the Percentile function. The function needs an Object as a...
2
by: twinklyblue | last post by:
Hi team, I am creating a function that would accept an array of integer as its parameter. I have a table where one of its column is declared as an array. This is an excerpt from the script that...
1
by: anniefs | last post by:
hi guys plz help me in this code i m trying to call the vb function in javascript function and im also passing parameter like array function save() { var name; p2_array=1; p2_array=2;...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...

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.