sql >> Database teknologi >  >> RDS >> Oracle

Opdel IPv4-adresse i 4 numre i Oracle sql

Du kan bruge regexp_substr :

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



  1. TNS-12519 uden maksimale processer nået

  2. java.lang.IllegalArgumentException:kolonne '_id' findes ikke

  3. Sådan vises alle lagrede procedurer i Oracle-databasen

  4. Dybt dyk ned i NoSQL:En komplet liste over NoSQL-databaser