Skip to main content
Skip to main content

IPV4NUMTOSTRING

IPv4NumToString

SinceVersion dev

IPv4NumToString

description

Syntax

VARCHAR IPv4NumToString(BIGINT ipv4_num)

Takes a Int16、Int32、Int64 number. Interprets it as an IPv4 address in big endian. Returns a string containing the corresponding IPv4 address in the format A.B.C.d (dot-separated numbers in decimal form).

notice

will return NULL if the input parameter is negative or larger than 4294967295(num value of '255.255.255.255')

example

mysql> select ipv4numtostring(3232235521);
+-----------------------------+
| ipv4numtostring(3232235521) |
+-----------------------------+
| 192.168.0.1 |
+-----------------------------+
1 row in set (0.01 sec)

mysql> select num,ipv4numtostring(num) from ipv4_bi;
+------------+------------------------+
| num | ipv4numtostring(`num`) |
+------------+------------------------+
| -1 | NULL |
| 0 | 0.0.0.0 |
| 2130706433 | 127.0.0.1 |
| 4294967295 | 255.255.255.255 |
| 4294967296 | NULL |
+------------+------------------------+
7 rows in set (0.01 sec)

keywords

IPV4NUMTOSTRING, IP