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

24 lines
534 B
MySQL
Raw Normal View History

DELIMITER $$
2024-08-20 08:06:10 +00:00
CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`buy_recalcPricesByAwb`(IN awbFk varchar(18))
BEGIN
/**
* inserta en tmp.buyRecalc las compras de un awb
*
* @param awbFk
*/
DROP TEMPORARY TABLE IF EXISTS tmp.buyRecalc;
CREATE TEMPORARY TABLE tmp.buyRecalc
SELECT b.id
FROM buy b
JOIN entry e ON e.id = b.entryFk
2024-01-25 16:33:54 +00:00
JOIN travel t ON t.id = e.travelFk
JOIN awb a ON a.id = t.awbFk
WHERE a.code = awbFk;
CALL buy_recalcPrices();
DROP TEMPORARY TABLE tmp.buyRecalc;
END$$
DELIMITER ;