473,698 Members | 2,603 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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(c x_Oracle.STRING , ['1','3'])
curs.execute('B EGIN text( :1 ); end;', [p_array] )

And it gives me back an error:
cx_Oracle.Datab aseError: 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 8395
lu********@gmai l.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(c x_Oracle.STRING , ['1','3'])
curs.execute('B EGIN text( :1 ); end;', [p_array] )

And it gives me back an error:
cx_Oracle.Datab aseError: 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(c x_Oracle.STRING , ['1','3'])
curs.execute('B EGIN 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.ew u.eduwrote:
lukasz....@gmai l.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(c x_Oracle.STRING , ['1','3'])
curs.execute('B EGIN text( :1 ); end;', [p_array] )
And it gives me back an error:
cx_Oracle.Datab aseError: 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(c x_Oracle.STRING , ['1','3'])
curs.execute('B EGIN 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.ew u.eduwrote:
lukasz....@gmai l.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(c x_Oracle.STRING , ['1','3'])
curs.execute('B EGIN text( :1 ); end;', [p_array] )
And it gives me back an error:
cx_Oracle.Datab aseError: 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(c x_Oracle.STRING , ['1','3'])
curs.execute('B EGIN 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
2747
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. The way I have written my code makes g++ complain about it not being static. BTW I am new to the C++ language and also the templates it provides. Here is an example of what I want to do
6
10820
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 to point this at another array! }
5
4654
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, 'value1:value2:value3');
4
11166
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 append the param the the parameters collection but I can not get the result I am looking for. I am using VBScript dim cmd
2
2066
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 testing. In a particular test case, an array is passed to the Method Under Test, and then that MUT performs a ReDim on the array. The test code then needs to check the array, but the effect of the ReDim statement does not propagate to the test...
3
2042
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. I need help with this one. 'Public Function Multiply(A(,) As Double, B() As Double) As Double()' is not CLS-compliant because it overloads 'Public Function Multiply(A(,) As Double, B(,) As Double) As Double(,)' which differs from it only by...
7
2735
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 parameter, but I'm trying to pass it an Array. Here's some of my code: Imports Microsoft.Office.Interop.Excel Dim worksheetFunction1 As WorksheetFunction percentileValue = worksheetFunction1.Percentile(intenArray, inputPerValue) I get the...
2
10295
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 I was creating: create or replace function insert_busshours(bigint, varchar, integer) returns integer as ' begin insert into businesshours values ($1,$2,$3); return ''0'';
1
1553
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; p2_array=3;
0
8680
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8609
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9169
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8899
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7738
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4371
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4622
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3052
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2007
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.