DBD::Oracle::st execute failed: ORA-01008: not all variables bound (DBD ERROR: OCIStmtExecute) [for Statement "SELECT count(*) FROM trans_hist WHERE TO_CHAR(sched_dttm,'YY/MM/DD') = ? and dep_id = ? and file_id = ?" with ParamValues: :p1='07/03/07', :p2='1', :p3='300'] at QueMgrDaemon.pl line 2318. Can't execute statement: SELECT count(*) FROM trans_hist WHERE TO_CHAR(sched_dttm,'YY/MM/DD') = ? and dep_id = ? and file_id = ? , ORA-01008: not all variables bound (DBD ERROR: OCIStmtExecute) at QueMgrDaemon.pl line 2318. #### { my $sth; sub CheckTransmissionHist { my ( $FileId, $DepartmentID, $ScheduleDttm) = @_; $ScheduleDttm = '07/03/07'; my $ltqs_dbh = &ConnectToDatabase(); my $SelStatement = "SELECT count(*) FROM trans_hist WHERE TO_CHAR(sched_dttm,'YY/MM/DD') = ? and dep_id = ? and file_id = ?"; unless( defined($sth)) { $sth = $ltqs_dbh->prepare($SelStatement) or die "Can't prepare statement:$SelStatement , $DBI::errstr"; } $sth->bind_param( 1, $ScheduleDttm ) or die "BOOM"; $sth->bind_param( 2, $DepartmentID ) or die "BOOM"; $sth->bind_param( 3, $FileId ) or die "BOOM"; $sth->execute() or die "Can't execute statement: $SelStatement , $DBI::errstr"; .... ....