Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > a cx_Oracle ORA-01036 problem

Reply
Thread Tools

a cx_Oracle ORA-01036 problem

 
 
Damjan
Guest
Posts: n/a
 
      05-05-2005
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 \
EBTEUR, EBTDEN, to_date(:INVOICE_DATE,'DD.MM.YY'),
to_date(AYMENT_DEADLINE,'DD.MM.YY'), OINTS)"""

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?


--
damjan
 
Reply With Quote
 
 
 
 
vincent wehren
Guest
Posts: n/a
 
      05-05-2005
"Damjan" <(E-Mail Removed)> schrieb im Newsbeitrag
news:(E-Mail Removed)...
| 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 \
| EBTEUR, EBTDEN, to_date(:INVOICE_DATE,'DD.MM.YY'),
| to_date(AYMENT_DEADLINE,'DD.MM.YY'), OINTS)"""
|
| 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


 
Reply With Quote
 
 
 
 
Damjan
Guest
Posts: n/a
 
      05-05-2005
vincent wehren wrote:
> | 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.

--
damjan
 
Reply With Quote
 
Miles
Guest
Posts: n/a
 
      05-06-2005
Damjan wrote:
> 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 \
> EBTEUR, EBTDEN, to_date(:INVOICE_DATE,'DD.MM.YY'),
> to_date(AYMENT_DEADLINE,'DD.MM.YY'), OINTS)"""
>
> 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
 
Reply With Quote
 
Damjan
Guest
Posts: n/a
 
      05-12-2005
>> SQL = """insert into D.D_NOTIFY values (:CARDREF, :BANKKEY, :OK1, :OK2 \
>> EBTEUR, EBTDEN, to_date(:INVOICE_DATE,'DD.MM.YY'),
>> to_date(AYMENT_DEADLINE,'DD.MM.YY'), OINTS)"""
>>


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


--
damjan
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with environment variables and cx_Oracle Brandon Taylor Python 1 02-25-2009 12:28 AM
cx_Oracle-5.0 Problem Brandon Taylor Python 2 02-12-2009 07:24 PM
Unicode / cx_Oracle problem Richard Schulman Python 8 09-16-2006 09:03 PM
RE: Oracle beginner problem: can't connect to Oracle using cx_Oracle Pieter Claerhout Python 0 01-28-2004 01:13 PM
Oracle beginner problem: can't connect to Oracle using cx_Oracle Benson, John Python 1 01-28-2004 12:55 PM



Advertisments