IS_IPV6_STRING
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
mysql> select is_ipv6_string(NULL);
+----------------------+
| is_ipv6_string(NULL) |
+----------------------+
| NULL |
+----------------------+
mysql> CREATE TABLE `test_is_ipv6_string` (
`id` int,
`ip_v6` string
) ENGINE=OLAP
DISTRIBUTED BY HASH(`id`) BUCKETS 4
PROPERTIES (
"replication_allocation" = "tag.location.default: 1"
);
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');
mysql> select id, is_ipv6_string(ip_v6) from test_is_ipv6_string order by id;
+------+-----------------------+
| id | is_ipv6_string(ip_v6) |
+------+-----------------------+
| 0 | NULL |
| 1 | 1 |
| 2 | 0 |
| 3 | 1 |
| 4 | 0 |
+------+-----------------------+
Keywords
IS_IPV6_STRING, IP