T
test
Greetings,
I have a perl file which is called from a ksh file. In this perl
script, I have to execute a procedure and get the output parameter.
this output paramtere(proces Date) needs to be compared with an input
parameter(run_date). If both dates are not same, I need to exit out of
the job. However, when I am trying to execute the procedure and
capture the value, it always returns 0. I am unable o capture this
date output and compare it with the input date. I am using DBI for
connectivity.
Below is the SAMPLE script. Can you please advise
my $sth;
$db_handle = &connectDB($server, $user, $password, $database);
my $extract_sql;
my $date_cmp_sql ;
$date_cmp_sql = "
DECLARE \@ReportDate DATETIME,
\@ProcessDate DATETIME
SELECT \@ReportDate ='$report_date'
EXEC $db_name..GetPriorDate 1, \@ReportDate, \@ProcessDate output
SELECT \@ProcessDate
";
my $st;
$st = $db_handle->prepare("$date_cmp_sql") or die("Could not prepare
for SQL statement");
$st->execute() or die localtime(time). " ---Can't excute SQL
statement: $DBI::errstr\n";
$err_str=$db_handle->errstr;
$err_no=$db_handle->err;
if ($err_str ne "")
{
print(" error \n");
exit 1;
}
my @RptFlag = ();
@RptFlag = $st->fetchrow_array() ;
my $RprtGenrFlag = $RptFlag[0];
print("RprtGenrFlag is $RprtGenrFlag \n\n");
##if ($Report_date eq "0")
$run_date = $RprtGenrFlag;
print("run_date is $run_date");
if($RprtGenrFlag eq $run_date)
{
print("two dates are equal \n");
}
else
{
print("dates are not equal \n");
}
$st->finish();
&disconnectDB ($db_handle, $server);
I have a perl file which is called from a ksh file. In this perl
script, I have to execute a procedure and get the output parameter.
this output paramtere(proces Date) needs to be compared with an input
parameter(run_date). If both dates are not same, I need to exit out of
the job. However, when I am trying to execute the procedure and
capture the value, it always returns 0. I am unable o capture this
date output and compare it with the input date. I am using DBI for
connectivity.
Below is the SAMPLE script. Can you please advise
my $sth;
$db_handle = &connectDB($server, $user, $password, $database);
my $extract_sql;
my $date_cmp_sql ;
$date_cmp_sql = "
DECLARE \@ReportDate DATETIME,
\@ProcessDate DATETIME
SELECT \@ReportDate ='$report_date'
EXEC $db_name..GetPriorDate 1, \@ReportDate, \@ProcessDate output
SELECT \@ProcessDate
";
my $st;
$st = $db_handle->prepare("$date_cmp_sql") or die("Could not prepare
for SQL statement");
$st->execute() or die localtime(time). " ---Can't excute SQL
statement: $DBI::errstr\n";
$err_str=$db_handle->errstr;
$err_no=$db_handle->err;
if ($err_str ne "")
{
print(" error \n");
exit 1;
}
my @RptFlag = ();
@RptFlag = $st->fetchrow_array() ;
my $RprtGenrFlag = $RptFlag[0];
print("RprtGenrFlag is $RprtGenrFlag \n\n");
##if ($Report_date eq "0")
$run_date = $RprtGenrFlag;
print("run_date is $run_date");
if($RprtGenrFlag eq $run_date)
{
print("two dates are equal \n");
}
else
{
print("dates are not equal \n");
}
$st->finish();
&disconnectDB ($db_handle, $server);