I need to find out the new shop id where the shop id is missing in the oracle table shoptable. all the processed shop name is present in the shop look up table ran_lookup. I need to print the shop id which is not present in the oracle table by checking the lookup ran_lookup. I have tried the below perl script but it is consuming more time. not sure fetchall_arrayref will get the first column of the data form the table. any other best alternative way to get the first column in the array.
#**********************************************************
# Read shops from database.
#**********************************************************
sub new_read_shop_lookup {
my ($ret_code) = @_;
my $dbh = DBI->connect('dbi:Oracle:ussmft', 'dsu', 'morning', {AutoCommit => 0, RaiseError => 1})
or die "Unable to connect to Oracle: $!";
my $sth = $dbh->prepare(qq{ select country_shop_no from shoptable where country_file = ? });
$sth->execute($ret_code);
my $array = $sth->fetchall_arrayref();
foreach (@$array) {
print "$_ ";
}
$dbh1->disconnect;
return \@array;
}
&new_read_shop_lookup ($ret_code);
for my $new_shop (sort keys @array) {
if ( ! defined $ran_lookup{$new_shop} ) {
print "new shop is $new_shop\n";
}
}