MySQL IS_IPV4() Function

In MySQL, the IS_IPV4() function checks whether the given parameter is a valid IPv4 address.

IS_IPV4() Syntax

Here is the syntax of the MySQL IS_IPV4() function:



Required. An IPv4 address to check.

Return value

The MySQL IS_IPV4() function checks if the given parameter is a valid IPv4 address and returns 1 if it is, otherwise returns 0.

If the argument is NULL, the function will return NULL.

IS_IPV4() Examples

This example demonstrates the basic usage of IS_IPV4().

SELECT IS_IPV4(''), IS_IPV4('');
| IS_IPV4('') | IS_IPV4('') |
|                        1 |                        0 |

Here, since is not a valid IPv4 address, IS_IPV4('') returned 0.