DROP PROCEDURE IF EXISTS `check_if_product_exists`;
DELIMITER ;;
CREATE PROCEDURE `check_if_product_exists` (
    IN p_product_id INT,
    OUT p_return INT
)
proc:BEGIN
    IF (SELECT COUNT(id) FROM products WHERE id = p_product_id) = 0 OR p_product_id IS NULL THEN
        SET p_return = -1;
        LEAVE proc;
    END IF;
    SET p_return = 0;
END ;;
DELIMITER ;
