DELIMITER $$ CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `stock`.`inbound_addPick`( vSelf INT, vOutboundFk INT, vQuantity INT ) BEGIN INSERT INTO inboundPick SET inboundFk = vSelf, outboundFk = vOutboundFk, quantity = vQuantity ON DUPLICATE KEY UPDATE quantity = quantity + vQuantity; END$$ DELIMITER ;