DROP PROCEDURE IF EXISTS `update_user_location`;
DELIMITER ;;
CREATE PROCEDURE `update_user_location` (
    IN p_location VARCHAR(200),
    IN p_user_id INT,
    OUT p_status INT
)
proc:BEGIN
    IF p_location = '' OR p_location IS NULL THEN
        SET p_status = -1;
        LEAVE proc;
    END IF;
    UPDATE users SET location = p_location WHERE id = p_user_id;
    SET p_status = 0;
END ;;
DELIMITER ;
