That should probably be >= in the IF. I think it is possible for more than p_limit + p_offset worth of records to be added to v_result.
That should probably be >= in the IF. I think it is possible for more than p_limit + p_offset worth of records to be added to v_result.