[DB-SIG] create procedure / callproc question

Anthony Tuininga anthony@computronix.com
Wed, 04 Sep 2002 20:36:26 -0600


You need to do the following:

cursor.callproc("pump1", 1)

This isn't too obvious from the DB-API documentation but it does make
sense once you see one example... :-)

You can also use

cursor.execute("""
    begin
      pump1(1);
    end;""")

but that one is Oracle specific.

On Wed, 2002-09-04 at 13:59, Bob Gailer wrote:
> Using cx_Oracle:
> 
>  >>> cursor.execute("create or replace procedure pump1(a in number) as 
> begin null; end;")
>  >>> cursor.callproc("pump1(1)")
> 
> Results in:
> 
> DatabaseError: ORA-06550: line 1, column 7:
> PLS-00801: internal error [22503]
> ORA-06550: line 1, column 7:
> PL/SQL: Statement ignored
> 
> What do I need to fix?
> 
> My goal is to have an out parameter (or rmake pump1 a function) with
> data 
> returned to Python. What do I change to do that? I'm assuming the create
> 
> changes to:
> 
> "create or replace procedure pump1(a out number) as begin a :=
> something; end;"
> 
> I also notice that if I make an error in the create statement, execute 
> returns no error to Python!
> 
> Bob Gailer
> mailto:ramrom@earthling.net
> 303 442 2625