DELIMITER $$
CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `stock`.`buyPick_remove`(
	vSelf INT,
	vQuantity INT,
	vTotalQuantity INT
)
BEGIN
	IF vQuantity < vTotalQuantity THEN
		UPDATE buyPick
			SET quantity = quantity - vQuantity
			WHERE id = vSelf;
	ELSE
		DELETE FROM buyPick
			WHERE id = vSelf;
	END IF;
END$$
DELIMITER ;
