MySQL Forums
Forum List  »  Perl

Update failure with Err 1172
Posted by: Mike Moran
Date: September 12, 2011 10:40AM

I've got the following bits of code

my $status_UPDATE = $dbh->prepare(<<END_SQL) || die("Can't prepare UPDATE: $DBI::errstr");
UPDATE orders_batches AS ob
       INNER JOIN orders AS o
               ON o.order_id = ob.order_id
   SET o.status_id = ?
 WHERE ob.batch_id = ?
END_SQL

which is called from

sub ChangeBatchStatus {
    my $B = shift;
    my $S = shift;

    LogIt(DEBUG, "$proof ChangeBatchStatus => $B -> $S");

    eval { $status_UPDATE->execute($S, $B) };
    if ($@) {
        LogIt(ERROR, "$proof Could not update status_id to <$S> for batch_id [$B] => $@");
        LogIt(ERROR, "DBI::err:  $DBI::err");
        LogIt(ERROR, "DBI::errstr   $DBI::errstr");
        LogIt(ERROR, "DBI::state   $DBI::state");
        $dbh->rollback;
        return 0;
    }

    $dbh->commit;

    return 1;
}

99.9% of the time it properly handles the update where the batch contains up to 10,000 items.. the remaining 0.1% of the update returns

Err 1172 DBD::mysql::st execute failed: Result consisted of more than one row

Any thought or suggestions? I'm stumped.



Edited 1 time(s). Last edit at 09/12/2011 10:45AM by Mike Moran.

Options: ReplyQuote


Subject
Written By
Posted
Update failure with Err 1172
September 12, 2011 10:40AM
September 15, 2011 12:36PM
September 15, 2011 02:57PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.