ID EN
Miscellaneous Functions

IS_IPV6(expr)

MySQL 8.4

Returns 1 if the argument is a valid IPv6 address specified as a string, 0 otherwise, unless expr is NULL, in which case the function returns NULL. This function does not consider IPv4 addresses to be valid IPv6 addresses.

Syntax

MYSQL
SELECT IS_IPV6('10.0.5.9'), IS_IPV6('::1');
0, 1

Examples

Example

For a given argument, if IS_IPV6() returns 1, INET6_ATON() returns non-NULL.

MYSQL
SELECT IS_IPV6('10.0.5.9'), IS_IPV6('::1');
0, 1