TO_IPV4_OR_DEFAULT
SinceVersion dev
TO_IPV4_OR_DEFAULT
description
Syntax
IPV4 TO_IPV4_OR_DEFAULT(STRING ipv4_str)
与to_ipv4函数类似,但如果IPv4地址的格式非法,则返回0.0.0.0。
notice
入参ipv4_str如果为NULL,则返回0.0.0.0。
example
mysql> select to_ipv4_or_default('.');
+-------------------------+
| to_ipv4_or_default('.') |
+-------------------------+
| 0.0.0.0 |
+-------------------------+
mysql> select to_ipv4_or_default(NULL);
+--------------------------+
| to_ipv4_or_default(NULL) |
+--------------------------+
| 0.0.0.0 |
+--------------------------+
keywords
TO_IPV4_OR_DEFAULT, IP