Using cursor.callproc with zxJDBC

Gerhard Haering gerhard.haering at gmx.de
Thu Aug 8 04:33:11 EDT 2002


I have problems calling an Oracle stored procedure using zxJDBC (the one
shipped with Jython 2.1).

I call the stored procedure using DCOracle2 like this:
    cursor.callproc("%s.SCHEDULING_PKG.P_FILL_SCHEDULING" % PKGNAME,
        PN_PROJ_ID=self.id)

I've tried the following with zxZDBC:

    cursor.callproc("%s.SCHEDULING_PKG.P_FILL_SCHEDULING" % PKGNAME,
        [self.id])

But all I get is:

    PLS-00306: wrong number or types of arguments in call to 'P_FILL_SCHEDULING'
    ORA-06550: line 1, column 7:
    PL/SQL: Statement ignored
     [SQLCode: 6550], [SQLState: 65000]

Doing it manually like this seems to work, but looks of course ugly :-/

    cursor.execute("""
        BEGIN
            %s.SCHEDULING_PKG.P_FILL_SCHEDULING(%i);
        END;
        """ % (PKGNAME, self.id))

Could anybody please tell me how to invoke (Oracle) stored procedures from
Jython?

The Jython docs at http://www.jython.org/docs/zxjdbc.html didn't help me much
:-(

Oh yeah, if it matters, it's a real PROCEDURE that I want to call. It starts
with:

   PROCEDURE P_FILL_SCHEDULING(pn_PROJ_ID IN RELPROJECT.PROJ_ID%TYPE) IS

Gerhard
-- 
mail:   gerhard <at> bigfoot <dot> de       registered Linux user #64239
web:    http://www.cs.fhm.edu/~ifw00065/    OpenPGP public key id 86AB43C0
public key fingerprint: DEC1 1D02 5743 1159 CD20  A4B6 7B22 6575 86AB 43C0
reduce(lambda x,y:x+y,map(lambda x:chr(ord(x)^42),tuple('zS^BED\nX_FOY\x0b')))



More information about the Python-list mailing list