a cx_Oracle ORA-01036 problem

Discussion in 'Python' started by Damjan, May 5, 2005.

  1. Damjan

    Damjan Guest

    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?


    --
    damjan
     
    Damjan, May 5, 2005
    #1
    1. Advertising

  2. "Damjan" <> schrieb im Newsbeitrag
    news:...
    | 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
     
    vincent wehren, May 5, 2005
    #2
    1. Advertising

  3. Damjan

    Damjan Guest

    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
     
    Damjan, May 5, 2005
    #3
  4. Damjan

    Miles Guest

    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 \
    > :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
     
    Miles, May 6, 2005
    #4
  5. Damjan

    Damjan Guest

    >> 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)"""
    >>


    > 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
     
    Damjan, May 12, 2005
    #5
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. biteside
    Replies:
    0
    Views:
    4,386
    biteside
    Oct 13, 2003
  2. ravi

    ORA-01480 problem

    ravi, Dec 18, 2006, in forum: C++
    Replies:
    5
    Views:
    3,916
  3. Mauricio Martinez Garcia
    Replies:
    0
    Views:
    667
    Mauricio Martinez Garcia
    Jan 4, 2011
  4. Ian Kelly
    Replies:
    0
    Views:
    781
    Ian Kelly
    Jan 4, 2011
  5. CJM
    Replies:
    4
    Views:
    472
Loading...

Share This Page