I am using the following script to extract data, put the SR# into and array,
parse through the array, and use it in SQL to get other data. For some
reason it is not working correctly.
Can any one see what I am doing wrong?
Here is a sample of the output I get. You will notice that it is getting
the Correct SR# but not retrieving anything else. Any Ideas?
Thank you in advance
Lance
--------------> SR(DAILY_SR_FILE): 1-995504632
--------------> SR(bulk):
--------------> TITLE(bulk):
--------------> COUNT : 645
CODE:
$html_file_path = "$CUSTOM/content/daily_securetrak_new";
$bif_file_path = "$CUSTOM/content/daily_securetrak";
$bulk_load_filename = "$CUSTOM/bif/daily_securetrak.bif";
$template_filename =
"$CUSTOM/templates/daily_securetrak_main_build_template.html";
$template_comm_filename =
"$CUSTOM/templates/daily_securetrak_comm_build_template.html";
$daily_sr_file = "$CUSTOM/scripts/unique_sr_list.txt";
print "Extract started at: " . `date`;
use DBI;
$connect_string="DBI:Oracle:$SERVICE";
my $dbh = DBI->connect(
"DBI:Oracle:$SERVICE",
$oracle_user,
$oracle_password,
{
AutoCommit => 0,
LongTruncOk => TRUE,
PrintError => TRUE,
ChopBlanks => TRUE,
LongTruncOk => TRUE,
LongReadLen => 50000,
RaiseError => TRUE
}
) or die "connecting: $DBI::errstr";
open BULK, $daily_sr_file or die "Could not open file:$!";
my $line = 1;
while(my $ln = <BULK> ) {
$ln =~ s/\s//g; #remove all whitespace characters
print "--------------------------------------------------------->
\n";
print "--------------> SR(DAILY_SR_FILE): $ln\n";
my $get_case_text = $dbh->prepare("
SELECT
a.sr_num sr_num,
a.sr_title sr_title,
a.sr_stat_id sr_stst_id
FROM
s_srv_req a
WHERE sr_num = " . $dbh->quote($ln)
);
$get_case_text->execute or $dbh->errstr;
#use hashrefs instead of 17 variables
my $case = $get_case_text->fetchrow_hashref();
$get_case_text->finish;
print "--------------> SR(bulk): $case->{sr_num}\n";
print "--------------> TITLE(bulk): $case->{sr_title}\n";
print "--------------> COUNT : $line\n";
$line++;
}
close(BULK);
$dbh->disconnect;
|