Wednesday, October 03, 2012

How to split a phone no to country code,std code,Land Line



with ph as
(select '091-044-234678' phone from dual),
 ph1 as
(select phone,substr(phone,instr(phone,'-',1)+1) as phone2 from ph),
 ph2 as
(select phone,phone2,substr(phone2,instr(phone2,'-',1)+1) as phone3 from ph1)
select * from ph2
select substr(phone,0,instr(phone,'-',1)-1) phone,
substr(phone2,0,instr(phone2,'-',1)-1)phone2,phone3
 from ph2

No comments: