cx_Oracle callproc output parameters

infidel saint.infidel at
Tue Nov 8 22:53:19 CET 2005

I have a stored procedure that has a single output parameter.  Why do I
have to pass it a string big enough to hold the value it is to receive?
 Why can't I pass an empty string or None?

>>> import cx_Oracle as oracle
>>> connection = oracle.connect('usr/pwd at tns')
>>> cursor = connection.cursor()
>>> network_name, = cursor.callproc('my_pkg.get_network_name_sp', ('',))
Traceback (most recent call last):
  File "<interactive input>", line 1, in ?
DatabaseError: ORA-06502: PL/SQL: numeric or value error: character
string buffer too small
ORA-06512: at "USR.MY_PKG", line 35
ORA-06512: at line 1

The following works fine, but I don't like having to do it:

>>> network_name, = cursor.callproc('my_pkg.get_network_name_sp', (' ' * 32,))

Am I missing something obvious here?

More information about the Python-list mailing list