Hi monks the following is the error that i am getting when running the following script
############################################
# Function:
############################################
#Print deleting line details to file and Continue
sub outputdeletedlines
{
print $JBM " inside outputdeletedlines\n";
my $ai_div = $_[0];
my $ai_store = $_[1];
my $ai_reg = $_[2];
my $al_trans = $_[3];
#my $adt_h_date = $_[4];
my $org_adt_h_date = $_[4];
# print $JBM "-- $adt_h_date --";
my $adt_h_date = "'".$org_adt_h_date."'";
#2010-04-26 14:07:09
my $datetime = localtime();
my $file = $inputfile;
my $delete_log = '';
my $ac_seq_nbr;
my $ac_sale_amount;
#If already has input files, outputs name of current working f
+ile
#Else puts a default one in the current directory
if( $inputfile )
{
$delete_log = $file . "_delete_" . $master_job_no . "-
+" . $job_number . "\.log";
}
else{
$file = 'Default';
$delete_log = $file . "_delete_0-0\.log";
}
if( !$Config{delete_dir} )
{
$Config{delete_dir} = getcwd(). "/";
}
open( my $delete_fh, ">>", $Config{delete_dir} . $delete_log )
or die "Failed to open delete file\n";
my $SQL = "Select tran_seq_nbr, sale_amount
From KCPOS_Tran_Header
Where org_number = :org_no
And store_number = :str_no
And tran_number = :tran_no
And terminal_number = :term_no
And tran_Date = to_date(:tran_dt,'YYYY-MM-DD HH24:MI:SS')";
# And tran_Date = :tran_dt";
print $JBM "preparing delete SQL\n";
my $sth = $dbh->prepare($SQL)
or die "Couldn't prepare statement: " . $dbh->errstr;
# my $adt_h_date = $dbh->quote('$org_adt_h_date');
print $JBM "-- $adt_h_date --";
print $JBM "prepared SQL\n";
# $sth->execute(q{to_date('$adt_h_date','YYYY-MM-DD HH24:MI:SS
+')})
# or die "Couldn't execute statement: " . $sth->errstr;
$sth->bind_param(":org_no",$ai_div);
$sth->bind_param(":str_no",$ai_store,);
$sth->bind_param(":tran_no",$al_trans);
$sth->bind_param(":term_no",$ai_reg);
$sth->bind_param(":tran_dt",$adt_h_date);
$sth->execute()
or die "Couldn't execute statement: " . $sth->errstr;
( $ac_seq_nbr, $ac_sale_amount ) = $sth->fetchrow();
$sth->finish();
print $delete_fh "\n Tran_Seq_Nbr: $ac_seq_nbr\t Division: $ai
+_div\t Store : $ai_store\t
Register: $ai_reg\t Tran: $al_trans\t Date: $adt_h_date\t Sal
+e Amt: $ac_sale_amount";
close $delete_fh;
return;
}
I know its because of $adt_h_date field which has the value like '2007-08-10 00:00:00'
so how should i overcome this error
error is: Placeholder :0 invalid, placeholders must be >= 1 at C:/Perl/lib/DBD/Oracle.pm l
ine 273, <$data_fh> line 7.
thanks