IPV4_NUM_TO_STRING
SinceVersion dev
IPV4_NUM_TO_STRING
description
Syntax
VARCHAR IPV4_NUM_TO_STRING(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
1. mysql> select ipv4_num_to_string(3232235521);
2. +--------------------------------+
3. | ipv4_num_to_string(3232235521) |
4. +--------------------------------+
5. | 192.168.0.1 |
6. +--------------------------------+
7. 1 row in set (0.01 sec)
9. mysql> select num,ipv4_num_to_string(num) from ipv4_bi;
10. +------------+---------------------------+
11. | num | ipv4_num_to_string(`num`) |
12. +------------+---------------------------+
13. | -1 | NULL |
14. | 0 | 0.0.0.0 |
15. | 2130706433 | 127.0.0.1 |
16. | 4294967295 | 255.255.255.255 |
17. | 4294967296 | NULL |
18. +------------+---------------------------+
19. 7 rows in set (0.01 sec)
keywords
IPV4_NUM_TO_STRING, IP
