salix/db/routines/vn/procedures/ticket_getFreezeProblem.sql

17 lines
441 B
SQL

DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_getFreezeProblem`()
BEGIN
/**
* Update the problem of tickets whose client is frozen or unfrozen
*
* @table tmp.ticket(ticketFk, hasProblem)
*/
UPDATE tmp.ticket t
JOIN ticket ti ON ti.id = t.ticketFk
JOIN client c ON c.id = ti.clientFk
SET t.hasProblem = TRUE
WHERE c.isFreezed;
CALL ticket_setProblem('hasTicketRequest');
END$$
DELIMITER ;