$dbh->{AutoCommit} = 0; $dbh->{RaiseError} = 1; eval { $sql = "UPDATE stockhistory SET invoiced = 1 WHERE id = 737"; $sth = $dbh->prepare($sql) or die "Cannot prepare: " . $dbh->errstr(); $sth->execute(); }; $dbh->commit (); if ($@) { print "Transaction aborted because $@"; $dbh->rollback; }