python error PLS-00306: wrong number or types of arguments in

A

Adeoluwa Odein

Hello
I am using the zxJDBC package with jython (similar to python), and I
am having "python error PLS-00306: wrong number or types of arguments"
error when using the "callproc()" method to execute a stored
procedure.

The Oracle stored procedure takes a single OUT varchar2 parameter. My
code is as follows:

p = [None]
c.callproc('pkg1_returns', p);

....
What I am doing corresponds to the examples..but I can seem to know
why it is not working. Help.


"Adeoluwa"
 
J

John Gordon

In said:
Hello
I am using the zxJDBC package with jython (similar to python), and I
am having "python error PLS-00306: wrong number or types of arguments"
error when using the "callproc()" method to execute a stored
procedure.
The Oracle stored procedure takes a single OUT varchar2 parameter. My
code is as follows:
p = [None]
c.callproc('pkg1_returns', p);

If the procedure takes a varchar2 parameter, why are you passing [None]?

It might help if you posted the method signature of the Oracle stored
procedure you're trying to call.
 
A

Adeoluwa Odein

Thanks, your assistance will be greatly appreciated on the right way
forward. See the Stored Procedure Below -very simple:



create or replace package c2_pkg
as
procedure openc;
procedure closec;
procedure RS22(v out varchar);
end;
/

create or replace package body c2_pkg
as
v_first_time boolean := TRUE;
v_cursor number;
cursor srvr_cur
is
select distinct b.mid from SVR a,VAR b where a.mid = b.mid;

procedure openc
as
begin
if not srvr_cur%ISOPEN
then
open srvr_cur;
end if;

end openc;

procedure closec
as
begin
close srvr_cur;
end closec;


procedure RS22(v out varchar2)
as
-- Server varchar2(64);

begin
Server := NULL;
fetch srvr_cur into Server;
v := Server;

end RS22;

end;
/




















In said:
Hello
I am using the zxJDBC package with jython (similar to python), and I
am having "python error PLS-00306: wrong number or types of arguments"
error when using the "callproc()" method to execute a stored
procedure.

The Oracle stored procedure takes a single OUT varchar2 parameter.  My
code is as follows:
p = [None]
c.callproc('pkg1_returns', p);

If the procedure takes a varchar2 parameter, why are you passing [None]?

It might help if you posted the method signature of the Oracle stored
procedure you're trying to call.
 
J

John Gordon

In said:
Thanks, your assistance will be greatly appreciated on the right way
forward. See the Stored Procedure Below -very simple:

I don't see a procedure named "pkg1_returns", which is the prodecure
called by your code. Where is this procedure?
 
A

Adeoluwa Odein

The actual jython/python call is:

p = [None]
c.callproc('c2_pkg.RS22', p);

I used a placeholder initially; now that you have the SQL code, there
it is. It essentially invokes the stored procedure, and it should
return the OUT variable p, with some value. It doesn't have to be a
cursor fetch; even a minor text assignment.
 
J

John Gordon

In said:
The actual jython/python call is:
p =3D [None]
c.callproc('c2_pkg.RS22', p);
I used a placeholder initially; now that you have the SQL code, there
it is. It essentially invokes the stored procedure, and it should
return the OUT variable p, with some value. It doesn't have to be a
cursor fetch; even a minor text assignment.

That procedure is defined as taking one parameter, but you're passing
an empty parameter list. Why?
 
A

Adeoluwa Odein

It's taking an OUT parameter.. I'm just following the examples as
documented by zxJDBC. How can I fix it?



p =3D [None]
c.callproc('c2_pkg.RS22', p);
I used a placeholder initially; now that you have the SQL code, there
it is.  It essentially invokes the stored procedure, and it should
return the OUT variable p, with some value.  It doesn't have to be a
cursor fetch; even a minor text assignment.

That procedure is defined as taking one parameter, but you're passing
an empty parameter list.  Why?
 
A

Adeoluwa Odein

In said:
The actual jython/python call is:
p =3D [None]
c.callproc('c2_pkg.RS22', p);
I used a placeholder initially; now that you have the SQL code, there
it is.  It essentially invokes the stored procedure, and it should
return the OUT variable p, with some value.  It doesn't have to be a
cursor fetch; even a minor text assignment.

That procedure is defined as taking one parameter, but you're passing
an empty parameter list.  Why?

I'm new to jython...
 
J

John Gordon

It's taking an OUT parameter.. I'm just following the examples as
documented by zxJDBC. How can I fix it?

I suspect the example you're looking at was for a procedure which has no
arguments, so in that case it would make sense to pass an empty parameter
list.

I haven't worked with OUT parameters so I don't know if this will work,
but try it and see what happens:

my_string = ""
p = [my_string]
c.callproc('c2_pkg.RS22', p);
print p
 
A

Adeoluwa Odein

It's taking an OUT parameter.. I'm just following the examples as
documented by zxJDBC.  How can I fix it?

I suspect the example you're looking at was for a procedure which has no
arguments, so in that case it would make sense to pass an empty parameter
list.

I haven't worked with OUT parameters so I don't know if this will work,
but try it and see what happens:

  my_string = ""
  p = [my_string]
  c.callproc('c2_pkg.RS22', p);
  print p


The same error. The sample were found on the following site --I copied
exactly what is written there:
1. http://www.jython.org/archive/21/docs/zxjdbc.html
 
J

John Gordon

In said:
The same error. The sample were found on the following site --I copied
exactly what is written there:
1. http://www.jython.org/archive/21/docs/zxjdbc.html

Ah, I see. You're supposed to call c.fetchall() afterwards to retrieve
the OUT parameter.

Also, the example page defines the called object as a function, not a
procedure. Maybe that's the problem? Try defining RS22 as a function
and see if that helps.

You might also try defining it outside of a package, as that is how the
example code does it.
 
A

Adeoluwa Odein

if you define the function in the execute() method, it works (as seen
on the page). But this is a stored procedure already residing on the
DB. A function/procedure outside of a package, actually works, but
then you lose access to private data; which is while I used a package.
 
J

John Gordon

In said:
if you define the function in the execute() method, it works (as seen
on the page). But this is a stored procedure already residing on the
DB. A function/procedure outside of a package, actually works, but
then you lose access to private data; which is while I used a package.

Did you try changing RS22 from a procedure to a function inside the
package?
 
A

Adeoluwa Odein

Did you try changing RS22 from a procedure to a function inside the
package?

Correction, the previous actually works, and still gives me access to
private data. So I will most likely use it.
Basically, just call a function, outside a package. It resolves this
entire dilemma.
Implementing similar program in Perl DBI, works without any problem.
Python/Jython seem quite difficult to work with Store Procedures, in
my opinion. Thanks a lot.
 
A

Adeoluwa Odein

Did you try changing RS22 from a procedure to a function inside the
package?

The same problem, if done inside a package. I just left it outside a
package, and it works.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,539
Members
45,024
Latest member
ARDU_PROgrammER

Latest Threads

Top