[DB-SIG] RE: oracle and python
Greg Stein (Exchange)
gstein@exchange.microsoft.com
Wed, 29 Oct 1997 16:18:05 -0800
You accidentally clipped the line that said: foo = [ 47 ]
(i.e. it was a sequence)
-g
-----Original Message-----
From: roy@popmail.med.nyu.edu [SMTP:roy@popmail.med.nyu.edu]
Sent: Wednesday, October 29, 1997 8:32 AM
To: python-list@cwi.nl
Subject: Re: oracle and python
Jefu! <jefu@k2.knowledge2000.com> wrote:
> cur.execute("begin testprocs.t1(:1) ; end ; ", foo ) ;
>
> OracleDbError: EXECUTE caused a ORA-01008: not all variables bound
I make this mistake all the time!
The 2nd argument to execute() has to be a sequence, i.e. a tuple or
list.
That's why it can't bind the variables. Of course, it would be even
better if the oracledb module itself checked and returned a somewhat
more
useful error message :-)
You want:
cur.execute("begin testprocs.t1(:1) ; end ; ", [foo] )
The other variation on this which always catches me is that you can't
just do
"(foo)" to turn it into a tuple. You need to do "(foo,)". This is way
ugly, so I just do "[foo]".
--
Roy Smith <roy@popmail.med.nyu.edu>
New York University School of Medicine
550 First Avenue, New York, NY 10016
_______________
DB-SIG - SIG on Tabular Databases in Python
send messages to: db-sig@python.org
administrivia to: db-sig-request@python.org
_______________