Ver originalSET @bd = (SELECT CASE WHEN @bds REGEXP CONCAT('((,).*){',@cont,'}') THEN SUBSTRING_INDEX(SUBSTRING_INDEX(@bds,',',@cont+1),',',-1) ELSE NULL END);