cx_Oracle callproc output parameters

Lao Tzu saint.infidel at gmail.com
Wed Nov 9 15:46:29 CET 2005


Thanks!

On 11/9/05, Gerhard Häring <gh at ghaering.de> wrote:
> infidel wrote:
> > 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?
> > [...]
> > Am I missing something obvious here?
>
> You have to use variable objects to the callproc() that will hold the
> output values. This is an example using three VARCHAR output parameters.
>
> HTH,
>
> -- Gerhard
>
>
> import cx_Oracle
>
> con = cx_Oracle.connect("user/password at my_conn")
> cur = con.cursor()
>
> l_SchemaName = cur.var(cx_Oracle.STRING)
> l_DbName = cur.var(cx_Oracle.STRING)
> l_DomainName = cur.var(cx_Oracle.STRING)
>
> cur.callproc("TP_Lookup.GetSchema", (l_SchemaName, l_DbName, l_DomainName))
>
> print "You are connected to",
> print "the schema", l_SchemaName.getvalue(),
> print "at %s.%s" % (l_DbName.getvalue(), l_DomainName.getvalue())
>
>



More information about the Python-list mailing list