in reply to Re: Re: Re: Float values from MS SQL Server.
in thread Float values from MS SQL Server.

In summary. This bit of code gives:
while ( my @col_col = $sthZK_Update_extract->fetchrow() ) { my $Key_m = $col_col[0]; my $Cause = $col_col[1]; my $Aggregated_area = $col_col[2]; my $SUM_wixi = $col_col[3]; my $SUM_wi = $col_col[4]; my $SUM_xi = $col_col[5]; my $SUM_ni = $col_col[6]; my $Sum_wi2xi = $col_col[7]; print "\n^^^^^^\n$Key_m, $Aggregated_area, $Cause, $SUM_wixi, $S +UM_wi, $SUM_xi, $SUM_ni, $Sum_wi2xi\n"; } my $numerator_L = 2*($SUM_ni-$SUM_xi); my $denominator_L = 2*$SUM_xi; my $numerator_U = 2*($SUM_xi+2); my $denominator_U = 2*($SUM_ni-$SUM_xi);
Gives:
^^^^^^ 1, All, Circulatory_Disease, 2.1323785396701751E-4, 4.4283294159368431 +E-6, 1376, 4224420, 3.3947194253425559E-11 Use of uninitialized value in subtraction (-) at Creating_table_ZZI_Pa +ul.pl line 1210. Use of uninitialized value in subtraction (-) at Creating_table_ZZI_Pa +ul.pl line 1210. Use of uninitialized value in multiplication (*) at Creating_table_ZZI +_Paul.pl l ine 1211. Use of uninitialized value in addition (+) at Creating_table_ZZI_Paul. +pl line 12 16. Use of uninitialized value in subtraction (-) at Creating_table_ZZI_Pa +ul.pl line 1217. Use of uninitialized value in subtraction (-) at Creating_table_ZZI_Pa +ul.pl line 1217. Invalid n: 0

Replies are listed 'Best First'.
Re: Re: Re: Re: Re: Float values from MS SQL Server.
by Marcello (Hermit) on Mar 04, 2004 at 12:57 UTC
    Hi,

    Your problem is a scoping issues. You declare the variables as my variables in the while loop. After this loop, the variables will be gone. The solution is to declare these variables above the while loop.

    ALWAYS put use strict; use warnings; at the top of your Perl programs.

    Regards,

    Marcel