Home >Backend Development >PHP Tutorial > mysql批量更新数据解决思路

mysql批量更新数据解决思路

WBOY
WBOYOriginal
2016-06-13 13:38:26778browse

mysql批量更新数据
我的数据库有个YDD字段,字段里的值都是类似:5456淮南小区
我想把字段里的数字在mysql里给批量过滤掉
请问怎么实现呀?

------解决方案--------------------
第一次写mysql function,献给楼主你啦~ 很笨的方法实现的

SQL code
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 
                 
              
              
        
            
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn