Cursors in a Loop
Carsten Haese
carsten at uniqsys.com
Fri Jan 4 09:32:27 EST 2008
On Fri, 2008-01-04 at 00:03 -0800, Chris wrote:
> You should bind all variables to save the pool.
>
> cursor = connection.cursor()
> cursor.executemany("""insert into as_siebel_hosts_temp
> values (:whole, :lot, :of, :bind, :variables)
> """
> ,[(i,)[0] for i in hostlist]
> )
> connection.commit()
> connection.close()
Huh? In the OP's example, the table one has one column. I'll openly
admit that I don't know anything about Oracle, but that code doesn't
make sense to me. Maybe you're trying to execute a multi-row insert, but
that would be done with execute(), not executemany(), wouldn't it?
Also, isn't "[(i,)[0] for i in hostlist]" exactly the same as "[i for i
in hostlist]" which in turn is exactly the same as "hostlist"?
--
Carsten Haese
http://informixdb.sourceforge.net
More information about the Python-list
mailing list