L
Lars Purschke
Hi!
I've a perl script which inserts data to a database. Sometime I get an
error on the execute() statement. Now I want the script not to die but
to exit the loop and to try again with the next record. Does anyone know
how to realize that?
my $dbh = DBI->connect("dbi:ODBC:$dsn", "xyz", "xyz",
{ PrintError => 0,
RaiseError => 0}) or die "$DBI::errstr\n";
while( my(@row) = $sth->fetchrow_array ) {
die $sth->errstr if $sth->err;
$stmt = "Insert into .... ";
$rs = $dbh->prepare($stmt);
$rs->execute();
}
thanks
lars
I've a perl script which inserts data to a database. Sometime I get an
error on the execute() statement. Now I want the script not to die but
to exit the loop and to try again with the next record. Does anyone know
how to realize that?
my $dbh = DBI->connect("dbi:ODBC:$dsn", "xyz", "xyz",
{ PrintError => 0,
RaiseError => 0}) or die "$DBI::errstr\n";
while( my(@row) = $sth->fetchrow_array ) {
die $sth->errstr if $sth->err;
$stmt = "Insert into .... ";
$rs = $dbh->prepare($stmt);
$rs->execute();
}
thanks
lars