a cx_Oracle ORA-01036 problem

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Damjan

    a cx_Oracle ORA-01036 problem

    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(:INVOIC E_DATE,'DD.MM.Y Y'),
    to_date(:PAYMEN T_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_e ur, DEBTDEN=iznos_m kd, INVOICE_DATE=da tum_g,
    PAYMENT_DEADLIN E=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_e ur, DEBTDEN=iznos_m kd, INVOICE_DATE=da tum_g,
    PAYMENT_DEADLIN E=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','D D.MM.YY'),to_da te('%s','DD.MM. YY'),'%s')""" % fields

    Any ideas?


    --
    damjan
  • vincent wehren

    #2
    Re: a cx_Oracle ORA-01036 problem

    "Damjan" <gdamjan@gmail. com> schrieb im Newsbeitrag
    news:427a2b39_2 @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(:INVOIC E_DATE,'DD.MM.Y Y'),
    | to_date(:PAYMEN T_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_e ur, DEBTDEN=iznos_m kd, INVOICE_DATE=da tum_g,
    | PAYMENT_DEADLIN E=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_e ur, DEBTDEN=iznos_m kd, INVOICE_DATE=da tum_g,
    | PAYMENT_DEADLIN E=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','D D.MM.YY'),to_da te('%s','DD.MM. YY'),'%s')""" % fields
    |
    | Any ideas?
    |
    |
    | --
    | damjan


    Comment

    • Damjan

      #3
      Re: a cx_Oracle ORA-01036 problem

      vincent wehren wrote:[color=blue]
      > | c = db.cursor()
      > | c.execute(SQL, **args)
      >
      >
      > Shouldn't that be c.execute(SQL, args) (no **-unpacking of the
      > dictionary)?[/color]

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

      --
      damjan

      Comment

      • Miles

        #4
        Re: a cx_Oracle ORA-01036 problem

        Damjan wrote:[color=blue]
        > 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(:INVOIC E_DATE,'DD.MM.Y Y'),
        > to_date(:PAYMEN T_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_e ur, DEBTDEN=iznos_m kd, INVOICE_DATE=da tum_g,
        > PAYMENT_DEADLIN E=datum_d, POINTS=bodovi)
        >
        > And I get an ORA-01036 exception.[/color]

        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

        Comment

        • Damjan

          #5
          Re: a cx_Oracle ORA-01036 problem

          >> SQL = """insert into D.D_NOTIFY values (:CARDREF, :BANKKEY, :OK1, :OK2 \[color=blue][color=green]
          >> :DEBTEUR, :DEBTDEN, to_date(:INVOIC E_DATE,'DD.MM.Y Y'),
          >> to_date(:PAYMEN T_DEADLINE,'DD. MM.YY'), :POINTS)"""
          >>[/color][/color]
          [color=blue]
          > 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...[/color]

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


          --
          damjan

          Comment

          Working...