Outdated Version

You are viewing an older version of this section. View current production version.

INET6_NTOA

Converts an IPv6 or IPv4 internet address from its binary representation to its text representation.

Syntax

INET6_NTOA( bin_str )

Arguments

  • bin_str: binary string.

Return Type

String.

The return string is lowercase. It has a maximum length of 39 characters.

If the argument is not a valid address - returns NULL.

Examples

SELECT inet6_ntoa(unhex('0A000101'));
****
+-------------------------------+
| inet6_ntoa(unhex('0A000101')) |
+-------------------------------+
| 10.0.1.1                      |
+-------------------------------+
SELECT inet6_ntoa(unhex('48F3000000000000D4321431BA23846F'));
****
+-------------------------------------------------------+
| inet6_ntoa(unhex('48F3000000000000D4321431BA23846F')) |
+-------------------------------------------------------+
| 48f3::d432:1431:ba23:846f                             |
+-------------------------------------------------------+
SELECT inet6_ntoa(inet6_aton('2001:db8:8714:3a90::12'));
****
+--------------------------------------------------+
| inet6_ntoa(inet6_aton('2001:db8:8714:3a90::12')) |
+--------------------------------------------------+
| 2001:db8:8714:3a90::12                           |
+--------------------------------------------------+
SELECT hex(inet6_aton(inet6_ntoa(unhex('48F3000000000000D4321431BA23846F'))));
****
+------------------------------------------------------------------------+
| hex(inet6_aton(inet6_ntoa(unhex('48F3000000000000D4321431BA23846F')))) |
+------------------------------------------------------------------------+
| 48F3000000000000D4321431BA23846F                                       |
+------------------------------------------------------------------------+

Related Topics