a cx_Oracle ORA-01036 problem

vincent wehren vincent at visualtrans.de
Thu May 5 10:33:39 EDT 2005


"Damjan" <gdamjan at gmail.com> schrieb im Newsbeitrag 
news:427a2b39_2 at x-privat.org...
| I'm using Python 2.4, cx_Oracle-4.1 on Linux with Oracle instant client
| 10.1.0.3. This is the sql string:
|
| SQL = """insert into D.D_NOTIFY values (:CARDREF, :BANKKEY, :OK1, :OK2 \
|        :DEBTEUR, :DEBTDEN, to_date(:INVOICE_DATE,'DD.MM.YY'),
|        to_date(:PAYMENT_DEADLINE,'DD.MM.YY'), :POINTS)"""
|
| And I'm trying to execute it as:
|        c = db.cursor()
|        c.execute(SQL, CARDREF=id, BANKKEY=dc_kluc, OK1=okd, OK2=okc,
|          DEBTEUR=iznos_eur, DEBTDEN=iznos_mkd, INVOICE_DATE=datum_g,
|          PAYMENT_DEADLINE=datum_d, POINTS=bodovi)

| And I get an ORA-01036 exception.
|
| I also have tried
|        args = dict(CARDREF=id, BANKKEY=dc_kluc, OK1=okd, OK2=okc,
|          DEBTEUR=iznos_eur, DEBTDEN=iznos_mkd, INVOICE_DATE=datum_g,
|          PAYMENT_DEADLINE=datum_d, POINTS=bodovi)
|        c = db.cursor()
|        c.execute(SQL, **args)


Shouldn't that be c.execute(SQL, args) (no **-unpacking of the dictionary)?

--

Vincent Wehren


| Same thing.
|
| Everything works If I use python string substituion, like this sql:
| SQL = """insert into D.D_NOTIFY values (%s,'%s','%s','%s','%s','%s', \
|        to_date('%s','DD.MM.YY'),to_date('%s','DD.MM.YY'),'%s')""" % fields
|
| Any ideas?
|
|
| -- 
| damjan 





More information about the Python-list mailing list