惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

K
Kaspersky official blog
V
Visual Studio Blog
The Register - Security
The Register - Security
A
About on SuperTechFans
W
WeLiveSecurity
Attack and Defense Labs
Attack and Defense Labs
www.infosecurity-magazine.com
www.infosecurity-magazine.com
S
Security @ Cisco Blogs
Google Online Security Blog
Google Online Security Blog
U
Unit 42
Spread Privacy
Spread Privacy
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
S
Securelist
T
Tenable Blog
Help Net Security
Help Net Security
Recorded Future
Recorded Future
S
Secure Thoughts
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
The GitHub Blog
The GitHub Blog
G
GRAHAM CLULEY
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
MyScale Blog
MyScale Blog
The Hacker News
The Hacker News
H
Heimdal Security Blog
Microsoft Security Blog
Microsoft Security Blog
博客园 - 三生石上(FineUI控件)
Project Zero
Project Zero
T
Threat Research - Cisco Blogs
J
Java Code Geeks
T
Threatpost
Cyberwarzone
Cyberwarzone
Hacker News - Newest:
Hacker News - Newest: "LLM"
腾讯CDC
阮一峰的网络日志
阮一峰的网络日志
博客园_首页
WordPress大学
WordPress大学
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
M
MIT News - Artificial intelligence
人人都是产品经理
人人都是产品经理
S
Security Affairs
Security Latest
Security Latest
Martin Fowler
Martin Fowler
C
Cyber Attacks, Cyber Crime and Cyber Security
T
The Exploit Database - CXSecurity.com
Cisco Talos Blog
Cisco Talos Blog
L
LINUX DO - 热门话题
宝玉的分享
宝玉的分享
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
博客园 - Franky
C
CERT Recently Published Vulnerability Notes

博客园 - antony.net

移动版网页自动缩放问题 2011年国内五款值得关注网店系统 Enterprise Architect 7 入门教程大全 Enterprise Architect 业务过程建模 不同浏览器处理后退的一些异同 - antony.net - 博客园 23个.NET开源项目 js代码库 table css 固定表头 - antony.net Hash Tables in Javascript 在非UI线程中改变UI控件属性的通用方法 RSClientPrint打印 统计sql语句 文档格式批量转换(doc,txt,pdf等) 了解HTTP Headers的方方面面 XmlSerializer 常见问题疑难解答 webservices 水晶报表 - antony.net - 博客园 Build a Custom RadioButton Cell and Column for the DataGridView Control .NET 2.0 - WinForm Control - DataGridView 编程36计(二)
mysql 存储过程 游标
antony.net · 2010-12-24 · via 博客园 - antony.net

DELIMITER $$

DROP PROCEDURE IF EXISTS `SPLIT_SUB_STR0`$$

CREATE DEFINER=`admin`@`%` PROCEDURE `SPLIT_SUB_STR0`(INOUT str VARCHAR(1000) , split0 VARCHAR(1) ,OUT split VARCHAR(20))
BEGIN
 DECLARE  c INT;
 SET c=0;
SET c = LENGTH(SUBSTRING_INDEX(str,split0,1));
SET split = SUBSTRING(str, 1, c);
SET str = SUBSTRING(str, c + 2 );
    END$$

DELIMITER ;

DELIMITER $$

DROP PROCEDURE IF EXISTS `test`$$

CREATE DEFINER=`admin`@`%` PROCEDURE `test`()
BEGIN
 DECLARE  c INT;
#目标字符串
SET @a = '1,,3,4,5,6,12';
# 分隔符
SET @c = ',';
# 存储风格后的字符串
SET @b = '';
REPEAT
    # 调用上面的存储过程
    CALL SPLIT_SUB_STR0(@a, ',', @c);
    #将取得的字符串拼接,测试用
    
     SET @b =CAST(@b AS SIGNED INTEGER) + CAST(@c AS SIGNED INTEGER) ;
#当目标字符串为空时,停止循环
UNTIL @a = ''
END REPEAT;
# 查看结果
SELECT @a, @c, @b;
 
 
    END$$

DELIMITER ;