21 lines
623 B
SQL
21 lines
623 B
SQL
DELIMITER $$
|
|
CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`ticketObservation_addNewBorn`(vTicketFk INT)
|
|
BEGIN
|
|
|
|
/**
|
|
* Inserta observaciones para los tickets con clientes nuevos o recuperados
|
|
*
|
|
* @param vTicketFk Identificador de vn.ticket
|
|
*/
|
|
|
|
DECLARE vDescription VARCHAR(20) DEFAULT '¡Cliente NUEVO! ';
|
|
|
|
INSERT INTO vn.ticketObservation(ticketFk, observationTypeFk, description)
|
|
SELECT vTicketFk, ot.id, vDescription
|
|
FROM vn.observationType ot
|
|
WHERE ot.hasNewBornMessage
|
|
ON DUPLICATE KEY UPDATE description = CONCAT(vDescription, ticketObservation.description);
|
|
|
|
END$$
|
|
DELIMITER ;
|