Skip to main content
Skip to main content

TO_IPV4_OR_NULL

TO_IPV4_OR_NULL​

TO_IPV4_OR_NULL

Description​

Syntax​

IPV4 TO_IPV4_OR_NULL(STRING ipv4_str)

Same as to_ipv4, but if the IPv4 address has an invalid format, it returns NULL.

Notice​

If input is NULL, return NULL.

Example​

mysql> select to_ipv4_or_null('.');
+----------------------+
| to_ipv4_or_null('.') |
+----------------------+
| NULL |
+----------------------+

mysql> select to_ipv4_or_null(NULL);
+-----------------------+
| to_ipv4_or_null(NULL) |
+-----------------------+
| NULL |
+-----------------------+

Keywords​

TO_IPV4_OR_NULL, IP