IS_IPV6_STRING

SinceVersion dev

IS_IPV6_STRING

description

Syntax

BOOLEAN IS_IPV6_STRING(STRING ipv6_str)

Receive an IPv6 address in the form of a string as a parameter, and return true if it is a properly formatted and valid IPv6 address; On the contrary, return false.

notice

If the input parameter is NULL, return NULL, indicating invalid input

example

1. mysql> select is_ipv6_string(NULL);
2. +----------------------+
3. | is_ipv6_string(NULL) |
4. +----------------------+
5. |                 NULL |
6. +----------------------+

8. mysql> CREATE TABLE `test_is_ipv6_string` (
9. `id` int,
10. `ip_v6` string
11. ) ENGINE=OLAP
12. DISTRIBUTED BY HASH(`id`) BUCKETS 4
13. PROPERTIES (
14. "replication_allocation" = "tag.location.default: 1"
15. );

17. mysql> insert into test_is_ipv6_string values(0, NULL), (1, '::'), (2, ''), (3, '2001:1b70:a1:610::b102:2'), (4, 'ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffffg');

19. mysql> select id, is_ipv6_string(ip_v6) from test_is_ipv6_string order by id;
20. +------+-----------------------+
21. | id   | is_ipv6_string(ip_v6) |
22. +------+-----------------------+
23. |    0 |                  NULL |
24. |    1 |                     1 |
25. |    2 |                     0 |
26. |    3 |                     1 |
27. |    4 |                     0 |
28. +------+-----------------------+

keywords

IS_IPV6_STRING, IP