Oracle
 sql >> Datenbank >  >> RDS >> Oracle

Teilen Sie die IPv4-Adresse in 4 Zahlen in Oracle SQL auf

Sie könnten regexp_substr verwenden :

select ip,
       regexp_substr(ip, '\d+',1,1) as first_octet,
       regexp_substr(ip, '\d+',1,2) as second_octet,
       regexp_substr(ip, '\d+',1,3) as third_octet,
       regexp_substr(ip, '\d+',1,4) as fourth_octet
from  (select '10.20.30.40' AS ip from dual )ips;

Rextester-Demo