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 buy_getUltimate(vItemFk, 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 ;