--Pinyin returns the entire character string with all initial letters
BEGIN
DECLARE v_compare VARCHAR (255);
DECLARE V_return VARCHAR (255);
DECLARE I INT;
SET I = 1;
SET V_return = ';
While I < LENGTH (P_name) does
SET V_compare = SUBSTR (P_name, I, 1);
IF (V_compare! = ") Then
#SET V_return = CONCAT (V_return, ', ', v_compare);
SET V_return = CONCAT (V_return, Fristpinyin (V_compare));
#SET V_return = Fristpinyin (V_compare);
END IF;
SET i = i + 1;
End while;
IF (ISNULL (v_return) or V_return = ") Then
SET V_return = p_name;
END IF;
RETURN V_return;
END
--Fristpinyin take out the first letter of a single character
BEGIN
DECLARE V_return VARCHAR (255);
SET V_return = ELT (INTERVAL (CONV (HEX (Left (CONVERT (p_name USING GBK), 1), 16,10),
0xb0a1,0xb0c5,0xb2c1,0xb4ee,0xb6ea,0xb7a2,0xb8c1,0xb9fe,0xbbf7,
0XBFA6,0XC0AC,0XC2E8,0XC4C3,0XC5B6,0XC5BE,0XC6DA,0XC8BB,
0XC8F6,0XCBFA,0XCDDA,0XCEF4,0XD1B9,0XD4D1),
' A ', ' B ', ' C ', ' D ', ' E ', ' F ', ' G ', ' H ', ' J ', ' K ', ' L ', ' M ', ' N ', ' O ', ' P ', ' Q ', ' R ', ' S ', ' T ', ' W ', ' X ', ' Y ', ' Z ');
RETURN V_return;
END
MySQL while taking out Chinese character string first letter stored procedure (not distinguishing polyphone)