[Zope-DB] DCOracle2 OracleDate and parameter sequence problem

Christopher Jenkins cjenkin1@stanwell.com
Wed, 10 Oct 2001 17:57:46 +1000

"Matthew T. Kromer" wrote:
> Christopher Jenkins wrote:
> >Thank you very much for this fix.  I have discovered a couple
> >of other (related?) issues with strings and executemany().
> >
> >Suppose you have a table created by
> >
> >create table t (s char(10));
> >
> >Then from Python, given a cursor object object con:-
> >
> >>>>l1=[(None,),("hello",),(None,)]
> >>>>l2=[("",),("hello",),("",)]
> >>>>stmt="insert into t values (:1)"
> >>>>cur.executemany(stmt,l1)
> >>>>
> >4
> >
> >This call inserts three NULL values into the table
> >(ie. "hello" does not get inserted).  Continuing
> >
> >>>>cur.executemany(stmt+ " ",l2) # Force reparse
> >>>>
> >Traceback (most recent call last):
> >  File "<stdin>", line 1, in ?
> >  File
> >"/home/cjenkin1/oracle/Products/DCOracle2/DCOracle2/DCOracle2.py",
> >line 921, in executemany
> >    result = self._cursor.execute(batchend-batchstart)
> >dco2.DatabaseError: (1480, 'ORA-01480: trailing null missing from STR
> >bind
> >value')
> >
> Using the test program I attached, I cant reproduce your error on my
> system; I did put another change into DCOracle2 yesterday; I trust you
> grabbed the CVS version?
>   ------------------------------------------------------------------------
>                Name: stest.py
>    stest.py    Type: Plain Text (text/plain)
>            Encoding: 7bit

Thanks for looking at this.

Yes, I have the latest updates.  I ran your test program with the
following results:-

Traceback (most recent call last):
  File "stest.py", line 21, in ?
    c.executemany(stmt, l2)
line 921, in executemany
    result = self._cursor.execute(batchend-batchstart)
dco2.DatabaseError: (1480, 'ORA-01480: trailing null missing from STR

Examination of the table stest shows that it has four rows and
S is null in all rows.

I am using Oracle 9.0.1 and I assume you are using 8.1.  Perhaps
there is some incompatibility between the different versions of
the client libraries or there may be a bug in the version that
I am using - it would be useful to get results from a variety
of environments.

I am unsure as to what further tests I should run to try to
pinpoint the cause of the problem - I would welcome any
suggestions you might have.

I realise that unless the problem can be reproduced in another
environment, it will be difficult to track down the exact

Since the problem has an obvious work around (multiple
calls to execute()), it may not be worth spending a lot
of time on unless there are more reports of the same fault.

Thanks for all your help up to now - it is very much appreciated.