Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> DBD::Oracle - truncation error for float fields

DBD::Oracle - truncation error for float fields

From: lei wang <leiwang_q_at_hotmail.com>
Date: 18 Dec 2001 12:50:54 -0800
Message-ID: <af074b9c.0112181250.5f800906@posting.google.com>


I am trying to access Oracle 8.1.7 EE on Solaris 2.7 using DBD::Oracle. This is a table definition: create table testfloat (
f1 float,
f2 float);

and this is the sample data (seperated by '|'): 3.1709177517544510E+59|1.9149109999999970000E-129|

When I used the following query in Perl script, select * from testfloat

fetchrow_arrayref failed with the error: DBD::Oracle::st fetch failed: ORA-24345: A Truncation or null fetch error occurred (DBD ERROR: ORA-01406 error on field 2 of 2, ora_type 2) at myscript.pl line 123

But the following sql works fine:
select to_char(f1, '9.9999999999EEEE'), to_char(f2, '9.9999999999EEEE') from testfloat

It seems that in the first case, the float precision is too big, and perl has to truncate, but if I use to_char, that field becomes string, and it may has arbitrary length.

I really don't want to use to_char in sql. Is there any way to tell perl not to truncate, or just round a float?

Thanks. Received on Tue Dec 18 2001 - 14:50:54 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US