Home >Database >Mysql Tutorial >把字符串按照分割符分解成不同的部分

把字符串按照分割符分解成不同的部分

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-07 15:58:121075browse

select regexp_substr('A,B,C,D,E', '[^,]', 1, level, 'i') as str from dual connect by level = length('A,B,C,D,E') - length(regexp_replace('A,B,C,D,E', ',', '')) 1;

select regexp_substr('A,B,C,D,E', '[^,]+', 1, level, 'i') as str
from dual
connect by level length('A,B,C,D,E') - length(regexp_replace('A,B,C,D,E', ',', '')) + 1;
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