Re: [cx-oracle-users] Fetching NaN, -Infinity and +Infinity from BINARY_FLOAT or BINARY_DOUBLE colu
Brought to you by:
atuining
From: Amaury F. d'A. <ama...@gm...> - 2007-01-18 09:34:21
|
Hello, Boxhoorn wrote: > > When fetching a NaN number (nan in Python) from a BINARY_FLOAT or BINARY_DOUBLE > column, the following exception is raised. > > Traceback (most recent call last): > File "<stdin>", line 1, in ? > cx_Oracle.DatabaseError: ORA-01722: invalid number > > Similary, fetching Infinity (inf in Python) from a BINARY_FLOAT or BINARY_DOUBLE > column results in > > Traceback (most recent call last): > File "<stdin>", line 1, in ? > cx_Oracle.DatabaseError: OCI-22065: number to text translation for the given format causes overflow > > Inserting Infinity and NaN, however, works flawlessly. cx_Oracle always uses the OciNumber type to exchange numeric values with the database (this is the C equivalent of the NUMBER datatype). Here the error messages comes from the oci layer trying to convert your data into NUMBER values. Well, this won't help you, but I remember Anthony's proposal about following more closely the Python type when creating bind variables: http://sourceforge.net/mailarchive/forum.php?thread_id=30737382&forum_id=34464 I don't know how far he went in this direction, but an easy addition to his proposal is to create a BINARY_DOUBLE bind variable when the python type is 'double'. Then special values should pass unmodified from the database to the python client. Maybe wait for a future relase? -- Amaury Forgeot d'Arc |