Oracle to Mysql, I'm (still) lost...
duikboot
arjen.dijkstra%no%-%spam% at hccnet.nl
Mon Jan 19 13:35:58 EST 2004
It worked beautiful, thank you.
On Mon, 19 Jan 2004 13:44:11 +0100, Marc Boeren wrote:
>
> Hi,
>
> instead of
>
>> cursMy.execute("insert into %s values %s", (tabel, a_oracle))
>
> Try:
>
> sql = "insert into "+ tabel +" values ("
> comma = ""
> for value in a_oracle:
> sql+= comma + "%s"
> comma = ", "
> sql+= ")"
>
> or better:
>
> sql = "insert into %s values (" % tabel
> sql+= ", ".join(["%s"] * len(a_oracle))
> sql+= ")"
> cursMy.execute(sql, a_oracle)
>
> which does the same thing.
>
> Your original sql-statement looked (for the execute call) like it needed two
> (sql-style)parameters, when in fact it needs as much parameters as there are
> fields in the table. And, the table-name is not an sql-parameter, it is just
> something that needs filling in...
>
> Hope this helps,
>
> Cheerio, Marc.
More information about the Python-list
mailing list