say that i run a query that copies 100 records that was marked to be copied (out of 200) into a temp table then copy thew contents of that temp table into another table, now during this query, one of the 100 records causes a primary key violation
now if this happens i want to run another query which adds an entry to an error log table and delete all the data from that may have been copied from the temp table and clear the temp table itself
i'm wondering if i can throw an exception in MySQL so it can run my alternate code
NOTE: i do not want to use a transaction as it locks tables and i have other queries that run at the same time that need to read/write the the first table (they dont touch the records that have been marked to be copied thank to a flag that indicates that they've been marked)