Home  >  Article  >  Database  >  Oracle String 合并与拆分

Oracle String 合并与拆分

WBOY
WBOYOriginal
2016-06-07 17:03:161310browse

Oracle 10g及以上版本长字符串拆分成多行, 利用正则表达式, 功能类似于split:select dbms_lob.substr(regexp_substr(

Oracle 10g及以上版本

长字符串拆分成多行, 利用正则表达式, 功能类似于split:

select dbms_lob.substr(regexp_substr('abc,1234,ABCD,test', '[^,]+', 1, x.n)) field from dual, (select rownum n from dual connect by rownum

合并多行String记录:

table a 如下

字段   city

row1  上海

row2  北京

row3  昆明

row4  长春

select wmsys.wm_concat(city) from a; 

结果如下

上海,北京,昆明,长春,

linux

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