losing precision while selecting NUMBER values from Oracle 7.3
From: Ravi Kongara (Ravi.Kongara_at_Sun.COM)
Date: 09/21/04
- Next message: Michael Peppler: "DBD::Sybase 1.04.8 available"
- Previous message: Tim Bunce: "Re: losing precision while selecting NUMBER values from Oracle 7.3"
- Next in thread: Tim Bunce: "Re: losing precision while selecting NUMBER values from Oracle 7.3"
- Reply: Tim Bunce: "Re: losing precision while selecting NUMBER values from Oracle 7.3"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Tue, 21 Sep 2004 12:30:17 -0700 To: DBI-Users <dbi-users@perl.org>
Hi,
I'm using DBI 1.42, DBD::Oracle1.14 built on Oracle 8, Perl 5.6.1 on
Solaris 9.
Purpose of the script is to compare values between source and target
databases.
Source db is Oracle 7.3 and target db is Oracle 8.1.7.
Again and again i'm getting into the problem of losing precision/scale
of NUMBER values.
DBI script selects/displays 39 digits after the decimal point,
eventhough database has stored 40 digits, cutting off
last digit while selecting from source. Strangely, it displays all 40
digits from target, which is a Oracle 8 database.
When i select from SQLPLUS session, values are shown correctly. Both
source and target show 40 digits and they match.
Is there any clue what's happening..? why the last digit is lost when i
select using DBI from Oracle 7.
If, i use TO_CHAR function i get 39 digits from both source and target.
Code snippet
--------------------------
<. . . . . >
use DBI;
use Getopt::Long;
my $src_test_value = $src_dbh->selectrow_array("select
CONVERSION_RATE from $src_schema_name.$src_table_name where
FROM_CURRENCY_CODE = 'ZAR' and conversion_date = (select
max(conversion_date) from $src_schema_name.$src_table_name where
FROM_CURRENCY_CODE = 'ZAR')");
print "src conv rate = $src_test_value\n";
my $tgt_test_value = $tgt_dbh->selectrow_array("select
CONVERSION_RATE from $ods_schema_name.$ods_table_name where
FROM_CURRENCY_CODE = 'ZAR' and conversion_date = (select
max(conversion_date) from $ods_schema_name.$ods_table_name where
FROM_CURRENCY_CODE = 'ZAR')");
print "ods conv rate = $tgt_test_value\n";
<. . . . . . >
--------------------------
values printed are...
Comparing src -> tgt
src conv rate = .159616919393455706304868316041500399042
ods conv rate = .1596169193934557063048683160415003990423
------------------------------------------------------
Thanks,
Ravi
- Next message: Michael Peppler: "DBD::Sybase 1.04.8 available"
- Previous message: Tim Bunce: "Re: losing precision while selecting NUMBER values from Oracle 7.3"
- Next in thread: Tim Bunce: "Re: losing precision while selecting NUMBER values from Oracle 7.3"
- Reply: Tim Bunce: "Re: losing precision while selecting NUMBER values from Oracle 7.3"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|