Loading

【Oracle】oracle利用正则表达式拆分IP地址

使用oracle提供的regexp_substr()函数,对将IPV4地址分成4段:

select 
       v.ip as ip_address,
       regexp_substr(v.ip,'[^.]+',1,1) as A,
       regexp_substr(v.ip,'[^.]+',1,2) as B,
       regexp_substr(v.ip,'[^.]+',1,3) as C,
       regexp_substr(v.ip,'[^.]+',1,4) as D
from (select '192.168.253.183' as ip from dual) v

结果如下:

 

--------------------------------------------------------------

posted @ 2015-01-05 15:44  uzipi  阅读(1475)  评论(0编辑  收藏  举报