2024-01-15 11:31:03 +00:00
|
|
|
DELIMITER $$
|
2024-07-22 09:52:42 +00:00
|
|
|
CREATE OR REPLACE DEFINER=`vn-admin`@`localhost` PROCEDURE `vn`.`expeditionState_addByRoute`(vRouteFk INT, vStateCode VARCHAR(100))
|
2024-01-15 11:31:03 +00:00
|
|
|
BEGIN
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Inserta nuevos registros en la tabla vn.expeditionState, por rutas
|
|
|
|
*
|
|
|
|
* @param vRouteFk Identificador de vn.route
|
|
|
|
* @param vStateCode Corresponde a vn.expeditionStateType.code
|
|
|
|
*/
|
|
|
|
|
|
|
|
INSERT INTO vn.expeditionState(expeditionFk, typeFk)
|
|
|
|
SELECT e.id, est.id
|
|
|
|
FROM vn.expedition e
|
|
|
|
JOIN vn.ticket t ON t.id = e.ticketFk
|
|
|
|
JOIN vn.expeditionStateType est ON est.code = vStateCode
|
|
|
|
WHERE t.routeFk = vRouteFk;
|
|
|
|
|
|
|
|
END$$
|
|
|
|
DELIMITER ;
|