使用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
结果如下:
--------------------------------------------------------------