37 lines
571 B
MySQL
37 lines
571 B
MySQL
|
DELIMITER $$
|
||
|
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn2008`.`buy_tarifas_recalcular_almacen`(IN wh_id INT, IN datFEC DATE)
|
||
|
BEGIN
|
||
|
|
||
|
DECLARE done INT DEFAULT 0;
|
||
|
DECLARE idE INT;
|
||
|
|
||
|
DECLARE cur1 CURSOR FOR
|
||
|
SELECT Id_Entrada
|
||
|
FROM Entradas
|
||
|
JOIN travel ON travel.id = travel_id
|
||
|
WHERE landing >= datFEC AND wh_id IN (0,warehouse_id);
|
||
|
|
||
|
DECLARE CONTINUE HANDLER FOR SQLSTATE '02000' SET done = 1;
|
||
|
|
||
|
OPEN cur1;
|
||
|
|
||
|
REPEAT
|
||
|
|
||
|
FETCH cur1 INTO idE;
|
||
|
|
||
|
IF NOT done THEN
|
||
|
|
||
|
Call buy_tarifas_entry(idE);
|
||
|
|
||
|
|
||
|
|
||
|
END IF;
|
||
|
|
||
|
|
||
|
UNTIL done END REPEAT;
|
||
|
|
||
|
CLOSE cur1;
|
||
|
|
||
|
END$$
|
||
|
DELIMITER ;
|