求分割子字符串的函数 例: C15-0812-13-3 长度不固定,求各横杠之间的各子字符串 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 用個while 用instr 逐個來取 使用正则表达式:select regexp_substr('C15-0812-13-3','[[:alnum:]]{1,}-',1,1,'i') from dual;select regexp_substr('C15-0812-13-3','[[:alnum:]]{1,}-',1,2,'i') from dual;select regexp_substr('C15-0812-13-3','[[:alnum:]]{1,}-',1,3,'i') from dual; 问题14:http://topic.csdn.net/u/20081002/00/f8d90ba2-e2bb-412a-a0c5-1b6d518fc22a.html 我收藏的这段代码,赚了不少分的说。with t1 as ( select 'C15-0812-13-3' label from dual)select * from ( select trim(substr(label ,instr(label, '-', 1, rn) + 1 ,instr(label, '-', 1, rn + 1) - instr(label, '-', 1, rn) - 1 ) ) label from ( --笛卡尔积 select '-' || t1.label || '-' as label, x.rn from t1, ( --这里构成一个序列 select rownum rn from ( select max(length(label) - length(replace(label, '-'))) + 2 comma_cnt --"-"的数量 from t1 ) connect by rownum <= comma_cnt ) x ) ) where label is not null 哈哈,压箱底的货?那不客气了,收下呵呵.其实mantisXF总结了很多,他那个帖子没被推荐帖,真不知道这些版主怎么当的. ORACLE 存储过程授权 怎么把access数据库表中某列的值求和? 关于nologging问题,高手请进 安装出错 有没有哪本电子书把SQL语法讲得很透彻的? 如何设置用户权限让他不能看到sys等用户的view(视图)? 在线急等,现场给分 请教,关于在Oracle快速导入数据以及导出文本的一些问题。 ORACLE连接信息问题 高手帮我解决一下为何这句oracle语法错在那里? 一个before的insert的行触发? 请问用alter语句 怎么改变一个column的size? 更改数据库的参数问题~~
select regexp_substr('C15-0812-13-3','[[:alnum:]]{1,}-',1,1,'i') from dual;
select regexp_substr('C15-0812-13-3','[[:alnum:]]{1,}-',1,2,'i') from dual;
select regexp_substr('C15-0812-13-3','[[:alnum:]]{1,}-',1,3,'i') from dual;
http://topic.csdn.net/u/20081002/00/f8d90ba2-e2bb-412a-a0c5-1b6d518fc22a.html
select 'C15-0812-13-3' label
from dual
)
select *
from
(
select trim(substr(label
,instr(label, '-', 1, rn) + 1
,instr(label, '-', 1, rn + 1) - instr(label, '-', 1, rn) - 1
)
) label
from
(
--笛卡尔积
select '-' || t1.label || '-' as label, x.rn
from t1, (
--这里构成一个序列
select rownum rn
from (
select max(length(label) - length(replace(label, '-'))) + 2 comma_cnt --"-"的数量
from t1
)
connect by rownum <= comma_cnt
) x
)
)
where label is not null
那不客气了,收下呵呵.
其实mantisXF总结了很多,他那个帖子没被推荐帖,真不知道这些版主怎么当的.