TO_IPV6_OR_DEFAULT

TO_IPV6_OR_DEFAULT

Description

Syntax

IPV6 TO_IPV6_OR_DEFAULT(STRING ipv6_str)

Same as to_ipv6, but if the IPv6 address has an invalid format, it returns :: (0 as IPv6).

Notice

If input is NULL, return :: (0 as IPv6).

Example

  1. mysql> select to_ipv6_or_default('.');
  2. +-------------------------+
  3. | to_ipv6_or_default('.') |
  4. +-------------------------+
  5. | :: |
  6. +-------------------------+
  7. mysql> select to_ipv6_or_default(NULL);
  8. +--------------------------+
  9. | to_ipv6_or_default(NULL) |
  10. +--------------------------+
  11. | :: |
  12. +--------------------------+

Keywords

TO_IPV6_OR_DEFAULT, IP