2024-04-16 15:01:14 +00:00
|
|
|
DELIMITER $$
|
|
|
|
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_setProblem`(
|
|
|
|
vProblemCode VARCHAR(25)
|
|
|
|
)
|
|
|
|
BEGIN
|
|
|
|
/**
|
2024-05-02 16:13:12 +00:00
|
|
|
* Update column ticket.problem with a problem code
|
|
|
|
* @table tmp.ticket(ticketFk, hasProblem)
|
2024-04-16 15:01:14 +00:00
|
|
|
*/
|
|
|
|
UPDATE ticket t
|
|
|
|
JOIN tmp.ticket tt ON tt.ticketFk = t.id
|
|
|
|
SET t.problem = CONCAT(
|
|
|
|
IF(tt.hasProblem,
|
|
|
|
CONCAT(problem, ',', vProblemCode),
|
|
|
|
REPLACE(problem, vProblemCode , '')));
|
|
|
|
END$$
|
|
|
|
DELIMITER ;
|