22 lines
563 B
MySQL
22 lines
563 B
MySQL
|
DELIMITER $$
|
||
|
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_getFreezeProblemByClient`(
|
||
|
vClientFk INT
|
||
|
)
|
||
|
proc: BEGIN
|
||
|
/**
|
||
|
* Actualiza los problemas de los ticket de hoy y a fututo cuyo cliente
|
||
|
* se encuentra congelado o deja de estarlo
|
||
|
*/
|
||
|
CREATE OR REPLACE TEMPORARY TABLE tmp.ticket
|
||
|
(INDEX(ticketFk))
|
||
|
ENGINE = MEMORY
|
||
|
SELECT t.id ticketFk, FALSE hasProblem
|
||
|
FROM ticket t
|
||
|
WHERE t.clientFk = vClientFk
|
||
|
AND t.shipped >= util.midnight();
|
||
|
|
||
|
CALL ticket_getFreezeProblem();
|
||
|
|
||
|
DROP TEMPORARY TABLE tmp.ticket;
|
||
|
END$$
|
||
|
DELIMITER ;
|