[Zope-DB] Floating point problem with Oracle
Matthew T. Kromer
Tue, 29 Oct 2002 10:28:31 -0500
Coi Giovanni wrote:
>we have a table (MOV) in Oracle with a filed like
>PRIZE NUMBER(13,3) with NULL
>values in this field are 1000.23, 1000.65, ecc.
>someone can tell us why the floating point v1 have no decimal values?
>The type is correct (float), the values into the table also (as you can see
>form v2 = v1 * 100).
>Where are my decimals?
>(You can see the same problem from Zope using ZSQLMethod)
>SuSE Linux 2.4.10
>DCOracle 2.1.2 (but the same with DCOracle 2.1.1)
>env variable about oracle or localization:
To handle LONG numbers, DCOracle2 fetches all numbers from Oracle as
strings, and then runs the C utility function sscanf() on them to
convert to a float when it needs to. Oracle is almost for sure
returning your values as 1000,23 1000,65 not 1000.23, 1000.65, right?
The indication is of a mismatch between the C locale and the Oracle locale.
Unfortunately, I tried to set my Oracle language like yours, and my
LC_ALL to it_IT, and sscanf() still mis-parsed my results. The best
information I have available to me is that it should do so.
Zope Corporation http://www.zope.com/