Re: [cx-oracle-users] How to read 16-digit numbers?
Brought to you by:
atuining
|
From: D.R. B. <da...@as...> - 2004-09-01 15:21:26
|
Hoi Guido,
All I can say is that the following works fine for me
% python
Python 2.3.3 (#1, May 24 2004, 12:04:05)
[GCC 3.2.3 20030502 (Red Hat Linux 3.2.3-24)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import cx_Oracle as odbc
>>>
>>> print odbc.version
4.0.1
>>>
>>> database =3D odbc.connect('ops$danny','ez','awtst.omegatest.nova.aw')
>>> cursor =3D database.cursor()
>>> cursor.execute('select 1234567800000001 from dual where 123456780000=
0001=3D:a',a=3D1234567800000001L)
[<NumberVar object at 0xb72f01d0>]
>>> print cursor.fetchall()
[(1234567800000001L,)]
>>> cursor.close()
Both binding and fetching seems to be ok, so it looks like a more complex
example is needed to expose your colleagues problem.
Cheers,
Danny
Kapteyn Institute / OmegaCEN e-mail: da...@as...
Postbus 800 tel.: +31 (0)50 3634056
9700 AV GRONINGEN fax.: +31 (0)50 3636100
THE NETHERLANDS http://www.astro-wise.org/
On Wed, Sep 01, 2004 at 07:10:22AM -0700, Guido van Rossum wrote:
> A certain table in our Oracle database contains 16-digit integers.
> These are a bit of a pain to get right at the best of times, but "set
> numformat 9999999999999999" makes it work in SQL*Plus. Now my colleague
> is complaining that when using cx_Oracle, the values come back with the
> lower digit(s?) truncated, as if they have somehow been converted to a
> floating point type and back that doesn't have enough bits. This seems
> strange to me, since an IEEE float *does* have enough bits for the
> values, and Python has no trouble with these at all. What are we
> missing? (A sample value is 1234567800000001.)
>=20
> --Guido van Rossum (home page: http://www.python.org/~guido)
>=20
>=20
> -------------------------------------------------------
> This SF.Net email is sponsored by BEA Weblogic Workshop
> FREE Java Enterprise J2EE developer tools!
> Get your free copy of BEA WebLogic Workshop 8.1 today.
> http://ads.osdn.com/?ad_idP47&alloc_id=10808&op?k
> _______________________________________________
> cx-oracle-users mailing list
> cx-...@li...
> https://lists.sourceforge.net/lists/listinfo/cx-oracle-users
|