No need to finish.
Finish is typically for cleaning up a select cursor when you
break out of fetching rows before the cursor is exhausted.
I'm sure there are other uses for it but that is the main one.
Also, is autocommit on? If  not you will need a commit in
there.  If you are actually doing 4 million records I would
suggest turning autocommit off and do period commits
every 50 records. (50 is just an example, you would need to
tune this number based on your current DB configuration)
Otherwise , looks ok to me.

"Chouda, Prem" wrote:

> Hi,
>
> A simple cross check - Can I use the bind param like this?
>
> $insert = " INSERT INTO test_db (Col1, Col2, Col3) VALUES (?,?,?) ";
> $sth = $dbh->prepare($insert);
>
> loop (4 Million times) {
>  $sth->execute($Val1, $Val2, $Val3);
> }
>
> $sth->finish;
> $dbh->disconnect;
>
> Thanks,
> Prem

Reply via email to