in reply to Deleting Multiple MySQL Rows With DBI
Remember, you only need to prepare a statement handle if you are going to re-use it for more than 1 query. Otherwise, you can use the Database Handle Methods for one-time queries. They encapsulate a prepare, execute, and sometimes a fetch-type method in a single call. For INSERT or UPDATE statements use DBI::do.
The following statement does a batch DELETE without using any 'Synthetic' Code, and is tested to work with MySQL:
$dbh->do( sprintf( 'DELETE FROM table WHERE message_id IN(%s)', join ',', ('?') x @MESSAGE_IDS ), {}, @MESSAGE_IDS, );
In Section
Seekers of Perl Wisdom