Hi,
Please direct me to the correct list if the problem is too elementary ...

I read data from a 9968 lines text file, one line at a time and use the data
to query a DB2 table (select count(*) from table_name where
column_name=data ).

The perl script core dumps after exactly 2479 queries every time
(segmentation fault).
The data is good and using Korn Shell script, I can query all the 9968 lines
OK.

The perl script loop is like this:
......
my $exist_prod_raw_clipaudio = $dbh->prepare_cached('SELECT count(*) as
count  from product.prod_raw_clipaudio where pm_upc = ?')
.......
open (UPCFILE,$filename) || die "Could not open $filename.";
open (SRCFILE,">$scriptname") || die "Could not open $scriptname.";

# Set auto flush for SRCFILE
my $oldfh = select (SRCFILE);
$| = 1;
select ($oldfh);

my $UPC;
my $rows;
my @row;
while (<UPCFILE>) {
    $UPC=$_;
    print "Got UPC as $UPC";
    chop $UPC;
    $exist_prod_raw_clipaudio->execute($UPC) || die "Couldn't execute
statement : " . $exist_prod_raw_clipaudio->errstr;
    $rows=0;
    while ( @row = $exist_prod_raw_clipaudio->fetchrow_array ) {
        print "Printing row now ...\n";
        print "\@row exists: " if (@row);
        print "@row : ";
#       print ".";
        $rows = $row[0];
    }
    print "\nGot $rows rows for UPC $UPC \n";
    print SRCFILE "rm $UPC*\n" if ($rows > 0 );
#   $exist_prod_raw_clipaudio->finish;
#   $update_clip_location_detail->finish;
}
$dbh->disconnect;

-------- End of script -----
The Output is like this :
........
Got UPC as 07464375452
Printing row now ...
@row exists: 14 :
Got 14 rows for UPC 07464375452
Got UPC as 07464375512
Printing row now ...
@row exists: 0 :
Got 0 rows for UPC 07464375512
Got UPC as 07464375932
Printing row now ...
Segmentation fault(coredump)


How should I diagonise this problem ?


Sumitro Chowdhury


Reply via email to