DELIMITER $$ CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_getRequestProblem`() BEGIN /** * Update the problems of tickets that have a pending ticketRequest or no longer have it * * @table tmp.ticket(ticketFk, hasProblem) */ UPDATE tmp.ticket t JOIN ticketRequest tr ON tr.ticketFk = t.ticketFk SET t.hasProblem = TRUE WHERE tr.isOK IS NULL; CALL ticket_setProblem('hasTicketRequest'); END$$ DELIMITER ;