, script. get_data() . , , : (), , main, , .
-, get_data ( , fetchall_hashref fetchrow_hashref:
sub get_data
{
undef $/;
open (my $QFH, "< /sql/summary.sql") or die "error can't open this file $!";
my $sth= $dbh_oracle->prepare(<$QFH>) or
die ("Cannot connect to the database: ".$DBI::errstr."\n");
$sth->execute;
close $QFH;
my $hash_ref = $sth->fetchall_hashref('MYTABLE');
$sth->finish;
return $hash_ref;
}
main :
my $hash_ref = get_data();
my $message = "";
foreach my $table (sort keys %$hash_ref) {
$message .= join(":", "Alert", $table, $$hash_ref{$table}{'FLAG'}) . "\n";
}
$message, :
Alert:INBOUND_DATA:0
Alert:MSGS_BY_DIM:0
Alert:OUTBOUND_DATA:0
:
$dbh_oracle->disconnect;
.
, , SQL, script, (MYTABLE, , , ) (FLAG) script, , .