日期:2014-05-17 浏览次数:20494 次
SET GLOBAL log_bin_trust_function_creators=TRUE; DROP FUNCTION IF EXISTS num_fiter; CREATE FUNCTION num_fiter(input varchar(255)) RETURNS VARCHAR(255) BEGIN DECLARE i INT; DECLARE length INT; DECLARE current VARCHAR(1); DECLARE temp VARCHAR(255); SET i=0; SET temp=''; SET length=LENGTH(input); WHILE i <= length DO SET current=SUBSTR(input FROM i FOR 1); IF current REGEXP '[0-9]' THEN SET current=''; END IF; SET temp=CONCAT(temp,current); SET i=i+1; END WHILE; RETURN temp; END; SELECT num_fiter('5456淮南小区');