Oracle
 sql >> Baza danych >  >> RDS >> Oracle

Podziel adres IPv4 na 4 liczby w Oracle sql

Możesz użyć 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;

Demo rextestera



  1. Database
  2.   
  3. Mysql
  4.   
  5. Oracle
  6.   
  7. Sqlserver
  8.   
  9. PostgreSQL
  10.   
  11. Access
  12.   
  13. SQLite
  14.   
  15. MariaDB
  1. Wyświetl listę wszystkich funkcji w bazie danych Oracle

  2. Lekko w pigułce

  3. Dodaj klucz podstawowy automatycznego przyrostu do istniejącej tabeli w Oracle

  4. Jak wyświetlić listę aktywnych/otwartych połączeń w Oracle?

  5. Funkcja LOCALTIMESTAMP() w Oracle