venkatpavan
Programmer
Hi,
I'm trying to check whether my insert statement executes successfully or not,Depending on this I'm using the counter,Below is the insert statement from my script,
$sql_Insert = qq {INSERT INTO TABLE VALUES(A,B,C,D)};
$sth_Insert = $dbconnection -> prepare ($sql_Insert) || die print "Couldn't prepare SQL query : $! :$line\n";
$sth_Insert -> execute || print "Couldn't execute SQL query: $!:$line\n";
if ($insert_results > 0){
print "Insert Successfull : $line\n";
$insertSuccessRecords++;
}
else{
print " Insert Failed : $line\n";
$insertFailRecords++;
}
Above condition always going through Insert successful even though insert fails,Please advice.
Thanks,
I'm trying to check whether my insert statement executes successfully or not,Depending on this I'm using the counter,Below is the insert statement from my script,
$sql_Insert = qq {INSERT INTO TABLE VALUES(A,B,C,D)};
$sth_Insert = $dbconnection -> prepare ($sql_Insert) || die print "Couldn't prepare SQL query : $! :$line\n";
$sth_Insert -> execute || print "Couldn't execute SQL query: $!:$line\n";
if ($insert_results > 0){
print "Insert Successfull : $line\n";
$insertSuccessRecords++;
}
else{
print " Insert Failed : $line\n";
$insertFailRecords++;
}
Above condition always going through Insert successful even though insert fails,Please advice.
Thanks,