DELIMITER $$ CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_getRequestProblemAll`() BEGIN /** * Update the problems of all tickets that have a pending ticketRequest or no longer have it */ DECLARE vHasProblem BOOL; CREATE OR REPLACE TEMPORARY TABLE tmp.ticket (INDEX(ticketFk)) ENGINE = MEMORY SELECT t.id ticketFk, FALSE hasProblem FROM ticket t WHERE t.shipped >= util.midnight(); CALL ticket_getRequestProblem(); DROP TEMPORARY TABLE tmp.ticket; END$$ DELIMITER ;