a cx_Oracle ORA-01036 problem

D

Damjan

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)
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?
 
V

vincent wehren

| 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
 
D

Damjan

vincent said:
| c = db.cursor()
| c.execute(SQL, **args)


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

Actually I tried that too, I still get the same error.
 
M

Miles

Damjan said:
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.

Try using a variable name other than "id" for the CARDREF variable... say
"card_id". id is a built in function name; I suspect your problem may be
that you are assiging that function to the variable rather than your intended
value...


Miles
 
D

Damjan

SQL = """insert into D.D_NOTIFY values :)CARDREF, :BANKKEY, :OK1, :OK2 \
Try using a variable name other than "id" for the CARDREF variable... say
"card_id". id is a built in function name; I suspect your problem may be
that you are assiging that function to the variable rather than your
intended value...

I changed it to 'cardref' but I'm still getting the same error.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top