$dbh = DBI->connect("dbi:sqlite:server=xxx;database=test","","") or die "$DBI::errstr\n"; $sth = $dbh->prepare(qq{select id,town from town}); my($id,$name,$n); $sth->execute() or die "error $DBI::errstr\n"; $sth->bind_columns(undef, \$id, \$name); while ($sth->fetch) { $dbh->do("insert into record(id,name) values ($id,'$name')") or die "can't insert into record\n"; $sth->commit if $n++ % 1000; ## the xxx error point to here,but i really don't know if it is a error } $sth->commit if $n $sth->finish; $dbh->disconnect;