Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> DBD::Oracle - truncation error for float fields
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