#the stuff at the top up to $sth->execute; my $insh=$dbh->prepare("INSERT INTO TestClearTransferData(AccountNo, TransferFlag, TransferType, RejectType, AdpNumber, Shares, ProcessingDate) VALUES ( ?, ?, ?, ?, ?, ?, ? )"); eval { while((@data) = $sth->fetchrow_array) { $insh->execute(@data); } }; if($@) { print STDERR "The insert died: $@"; } ...