DELIMITER $$ CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`buy_updatePacking`(vWarehouseFk INT, vItemFk INT, vPacking INT) BEGIN /** * Actualiza packing * * @param vWarehouseFk warehouse del item * @param vItemFk id del item * @param vPacking packing a actualizar */ CALL buyUltimate(vWarehouseFk, util.VN_CURDATE()); UPDATE buy b JOIN tmp.buyUltimate bu ON b.id = bu.buyFk SET b.packing = vPacking WHERE bu.warehouseFk = vWarehouseFk AND bu.itemFk = vItemFk; DROP TEMPORARY TABLE tmp.buyUltimate; END$$ DELIMITER ;