I am expecting to fetch all 5,812,750 records from table through Perl. Currently, I am getting an out of memory error. Any other best alternative way to read all the records.
sub sane {
my $self = shift;
my $dbh = DBI->connect(
'dbi:Oracle:usbmfs',
'US', 'states',
{ AutoCommit => 0, RaiseError => 1 }
);
my $sth = $dbh->prepare(qq{
select cpu_id, system, generation, vendor, item,
week_first_moved, week_last_moved
from us_item_tbl
});
$sth->execute();
my $rows = @{ $dbh->selectall_arrayref('
select upc_id, system, generation, vendor, item,
week_first_moved, eek_last_moved
from uk_item_tbl
') };
my %lookup;
foreach my $row (@$rows) {
my($cpu, sys, $gen, $vend, $item, $wad, $wlm) = @$rows;
my $ean = sprintf "%02s%05s%05s", $sys, $vend, $item;
$cpu = sprintf "%014s", $cpu;
$lookup{$nae}{$cpu} = [$wad, $wlm];
}
}