DELIMITER $$ CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`itemShelvingPlacementSupplyAdd`(vItemShelvingFk INT, vItemPlacementSupplyFk INT, vQuantity INT) BEGIN INSERT INTO vn.itemShelvingPlacementSupply( itemShelvingFk, itemPlacementSupplyFk, quantity, userFk) VALUES (vItemShelvingFk, vItemPlacementSupplyFk, vQuantity, getUser()); UPDATE vn.itemShelving SET visible = visible - vQuantity WHERE id = vItemShelvingFk; END$$ DELIMITER ;