CREATE DEFINER=`root`@`localhost` FUNCTION `ChineseCode`(s varchar(50)) RETURNS char(1) CHARSET latin1
BEGIN
DECLARE hz_code int;
DECLARE hz_py char;
SET hz_code=ord(substring(s,1,1))*256+ord(substring(s,2,1))-65536;
select py into hz_py from base_code where hz_code>=base_code.hz1 and hz_code<=base_code.hz2;
return hz_py;
END$$