Nesh has asked for the wisdom of the Perl Monks concerning the following question:
My script looks like:BA 1/1/2005 12/31/2999 11.3700000000000016 BO 1/1/2005 12/31/2999 7.5400000000000000 EQ 1/1/2005 12/31/2999 12.0700000000000000 FI 1/1/2005 12/31/2999 3.0000000000000000 MO 1/1/2005 12/31/2999 3.8000000000000000 SP 1/1/2005 12/31/2999 12.9900000000000000
Now this script instead of giving the 4th column exactly as it is rounds of the value and returns the rounded value. What changes do I need to make to get the exact values. Thanks Neshatuse warnings; use strict; use DBI; use POSIX qw(strftime); my $currSysDate =strftime ("%m/%d/%Y", localtime); my $currYear =strftime("%Y", localtime); my $dbh; my $dsn = "dbi:Oracle:hod3"; my $user = 'dbo'; my $password = 'dbo'; my $mffundclass; my $mfstartdate; my $mfenddate; my $mfror; my $mdstartdate; my $mdenddate; my $mddiscountrate; if($currSysDate eq "06/29/$currYear"){ open ROR, ">>RORTableValues_Nav.txt" or die "Error in opening RORT +ableValues_Nav.txt"; open DISCOUNT, ">>DiscountRateTableValues_Nav.txt" or die "Error i +n opening DiscountRateTableValues_Nav.txt"; printf ROR ("MF_FUND_CLASS \t MF_START_DATE \t MF_END_DATE \t MF_R +OR \n"); printf DISCOUNT ("MD_START_DATE \t MD_END_DATE \t MD_DISCOUNT_RATE + \n"); $dbh = DBI->connect($dsn, $user, $password, {PrintError => 1, Rais +eError => 1}) or die ("Can't execute statement: $DBI::errstr\n"); my $sql = qq{select * from T_LIMF_MRD_FUND_ROR}; my $sth = $dbh->prepare($sql); $sth->execute(); $sth->bind_columns(\$mffundclass,\$mfstartdate,\$mfenddate,\$mfror +); while ($sth->fetch()){ print "$mffundclass \t $mfstartdate \t $mfenddate \t $mfror \n +"; printf ROR "$mffundclass \t $mfstartdate \t $mfenddate \t $mfr +or \n"; }; $sth->finish(); my $sql1 = qq{select * from T_LIMD_MRD_DISCOUNT_RATE}; my $sth1 = $dbh->prepare($sql1); $sth1->execute(); $sth1->bind_columns(\$mdstartdate,\$mdenddate,\$mddiscountrate); while ($sth1->fetch()){ printf DISCOUNT "$mdstartdate \t $mdenddate \t $mddiscountrate + \n"; }; $sth1->finish(); $dbh->disconnect(); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Getting rounded off values from database.
by Codon (Friar) on Jul 07, 2005 at 00:16 UTC | |
|
Re: Getting rounded off values from database.
by monarch (Priest) on Jul 06, 2005 at 23:19 UTC | |
by Nesh (Beadle) on Jul 06, 2005 at 23:26 UTC | |
|
Re: Getting rounded off values from database.
by anonymized user 468275 (Curate) on Jul 07, 2005 at 11:01 UTC |