my $cdr_list = {}; eval { my $query = "EXEC prc_getUsage $run_id, 'CDR', '$start_account', '$end_account'"; print "\t\tpreparing query [$query]\n"; my $sth = $utils->{DBH}->prepare($query); print "\t\texecuting query\n"; $sth->execute(); my $i =1; print "\t\tfetching records\n"; while (my $record = $sth->fetchrow_hashref()) { my $msisdn = $record->{MSISDN}; #print "\t\tfetchrow [$msisdn] [$i]\n"; $i++; unless (defined $cdr_list->{$msisdn}) { $cdr_list->{$msisdn} = []; } push @{$cdr_list->{$msisdn}}, $record; } $sth->finish(); }; print "\t\tCompleted selecting CDRs\n"; if ($@) { # Try to check for connection error if ($@ =~ /(SQL\-28000)|(SQL\-08S01)/) { $utils->log_error("$@\n", $MAXIS_ERROR_DB_CONNECT); $utils->reconnect(); goto RETRY; } else { $utils->log_error("$@\n", $MAXIS_ERROR_SQL); print "Unhandled Exception [$@]\n"; return undef; } }