SelectDB Cloud
SQL 手册
SQL 函数
IP Functions
IPV6_CIDR_TO_RANGE

IPV6_CIDR_TO_RANGE

IPV6_CIDR_TO_RANGE

Description

Syntax

STRUCT<IPV6, IPV6> IPV6_CIDR_TO_RANGE(IPV6 ip_v6, INT16 cidr)

接收一个IPv6和一个包含CIDR的Int16值。返回一个结构体,其中包含两个IPv6字段分别表示子网的较低范围(min)和较高范围(max)。

Example

mysql> SELECT ipv6_cidr_to_range(ipv6_string_to_num('2001:0db8:0000:85a3:0000:0000:ac1f:8001'), 32);
+---------------------------------------------------------------------------------------+
| ipv6_cidr_to_range(ipv6_string_to_num('2001:0db8:0000:85a3:0000:0000:ac1f:8001'), 32) |
+---------------------------------------------------------------------------------------+
| {"min": "2001:db8::", "max": "2001:db8:ffff:ffff:ffff:ffff:ffff:ffff"}                |
+---------------------------------------------------------------------------------------+
 
mysql> SELECT ipv6_cidr_to_range(to_ipv6('2001:0db8:0000:85a3:0000:0000:ac1f:8001'), 32);
+----------------------------------------------------------------------------+
| ipv6_cidr_to_range(to_ipv6('2001:0db8:0000:85a3:0000:0000:ac1f:8001'), 32) |
+----------------------------------------------------------------------------+
| {"min": "2001:db8::", "max": "2001:db8:ffff:ffff:ffff:ffff:ffff:ffff"}     |
+----------------------------------------------------------------------------+
 
mysql> SELECT ipv6_cidr_to_range(NULL, NULL);
+--------------------------------+
| ipv6_cidr_to_range(NULL, NULL) |
+--------------------------------+
| NULL                           |
+--------------------------------+

Keywords

IPV6_CIDR_TO_RANGE, IP

© 2023 北京飞轮数据科技有限公司 京ICP备2022004029号 | Apache、Apache Doris 以及相关开源项目名称均为 Apache 基金会商标