drop table tel
create table tel(code varchar(20))
insert into tel values ('010-66667788')
insert into tel values ('010-55667788')
insert into tel values ('0755-56567788')
create table reg(code varchar(20),city varchar(20))
insert into reg values('010','北京')
insert into reg values('020','广州')
insert into reg values('0755','深圳')
select substr(code,0,3) from tel
select instr(code,'-') from tel
select substr(tel.code,0,instr(code,'-')-1) from tel
select replace('010','010','北京') from dual
select reg.city||' '||substr(tel.code,instr(tel.code,'-')+1),replace(replace(tel.code,substr(tel.code,0,instr(tel.code,'-')-1),reg.city),'-',' ')
from tel,reg where substr(tel.code,0,instr(tel.code,'-')-1)=reg.code
where条件加个or,判断区号是3位或4位匹配的,之前把你code里的非法字符去掉
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)