mysql自定义循环函数

FUNCTION deyes.f_getSplitStringByIndex1_8(stringIn text,
delimiter varchar(10),
indexIn int)
RETURNS text CHARSET utf8
COMMENT 'by wushuai'
BEGIN
DECLARE result varchar(255) DEFAULT '';
SET result = REVERSE(SUBSTRING_INDEX(REVERSE(SUBSTRING_INDEX(stringIn, delimiter, indexIn)), delimiter, 1));
RETURN result;
END FUNCTION deyes.f_getSplitStringTotal1_8(stringIn text,
delimiter varchar(10))
RETURNS int(11)
COMMENT 'by wushuai'
BEGIN
IF stringIn IS NOT NULL AND LENGTH(stringIn) <> 0 THEN
RETURN 1 + (LENGTH(stringIn) - LENGTH(REPLACE(stringIn, delimiter, '')));
ELSE
RETURN 0;
END IF;
END

  

上一篇:POJ 2771 二分图(最大独立集)


下一篇:patch与diff的恩怨