CREATE FUNCTION SPLIT_STR( x TEXT,//這裏改類型(varchar|char) delim VARCHAR(12), pos INT ) RETURNS VARCHAR(255) RETURN REPLACE(SUBSTRING(SUBSTRING_INDEX(x, delim, pos), LENGTH(SUBSTRING_INDEX(x, delim, pos -1)) + 1), delim, ''); 使用方法: SELECT SPLIT_STR('1^.8^.9^.10', '^.', 3-1);