IP Address Functions
This page provides reference information for the IP address-related functions in Databend. These functions help convert between string and numeric representations of IP addresses.
IP Address Conversion Functions
Function | Description | Example |
---|---|---|
INET_ATON / IPV4_STRING_TO_NUM | Converts an IPv4 address string to a 32-bit integer | INET_ATON('192.168.1.1') → 3232235777 |
INET_NTOA / IPV4_NUM_TO_STRING | Converts a 32-bit integer to an IPv4 address string | INET_NTOA(3232235777) → '192.168.1.1' |
Safe IP Address Conversion Functions
These functions handle invalid inputs gracefully by returning NULL instead of raising an error.
Function | Description | Example |
---|---|---|
TRY_INET_ATON / TRY_IPV4_STRING_TO_NUM | Safely converts an IPv4 address string to a 32-bit integer | TRY_INET_ATON('invalid') → NULL |
TRY_INET_NTOA / TRY_IPV4_NUM_TO_STRING | Safely converts a 32-bit integer to an IPv4 address string | TRY_INET_NTOA(-1) → NULL |