<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>OpenText Analytics Database 26.2.x – IP address functions</title>
    <link>/en/sql-reference/functions/data-type-specific-functions/ip-address-functions/</link>
    <description>Recent content in IP address functions on OpenText Analytics Database 26.2.x</description>
    <generator>Hugo -- gohugo.io</generator>
    
	  <atom:link href="/en/sql-reference/functions/data-type-specific-functions/ip-address-functions/index.xml" rel="self" type="application/rss+xml" />
    
    
      
        
      
    
    
    <item>
      <title>Sql-Reference: INET_ATON</title>
      <link>/en/sql-reference/functions/data-type-specific-functions/ip-address-functions/inet-aton/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>/en/sql-reference/functions/data-type-specific-functions/ip-address-functions/inet-aton/</guid>
      <description>
        
        
        &lt;p&gt;Converts a string that contains a dotted-quad representation of an IPv4 network address to an INTEGER. It trims any surrounding white space from the string. This function returns NULL if the string is NULL or contains anything other than a quad dotted IPv4 address.&lt;/p&gt;
&lt;h2 id=&#34;behavior-type&#34;&gt;Behavior type&lt;/h2&gt;
&lt;a class=&#34;glosslink&#34; href=&#34;../../../../../en/glossary/immutable-invariant-functions/&#34; title=&#34;&#34;&gt;Immutable&lt;/a&gt;
&lt;h2 id=&#34;syntax&#34;&gt;Syntax&lt;/h2&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;INET_ATON ( &lt;span class=&#34;code-variable&#34;&gt;expression&lt;/span&gt; )
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;arguments&#34;&gt;Arguments&lt;/h2&gt;
&lt;dl&gt;
&lt;dt&gt;&lt;code&gt;&lt;span class=&#34;code-variable&#34;&gt;expression&lt;/span&gt;&lt;/code&gt;&lt;/dt&gt;
&lt;dd&gt;the string to convert.&lt;/dd&gt;
&lt;/dl&gt;
&lt;h2 id=&#34;examples&#34;&gt;Examples&lt;/h2&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; SELECT INET_ATON(&amp;#39;209.207.224.40&amp;#39;);
 inet_aton
------------
 3520061480
(1 row)

=&amp;gt; SELECT INET_ATON(&amp;#39;1.2.3.4&amp;#39;);
 inet_aton
-----------
  16909060
(1 row)

=&amp;gt; SELECT TO_HEX(INET_ATON(&amp;#39;1.2.3.4&amp;#39;));
 to_hex
---------
 1020304
(1 row)
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;see-also&#34;&gt;See also&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;a href=&#34;../../../../../en/sql-reference/functions/data-type-specific-functions/ip-address-functions/inet-ntoa/#&#34;&gt;INET_NTOA&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href=&#34;../../../../../en/sql-reference/functions/data-type-specific-functions/ip-address-functions/v6-aton/#&#34;&gt;V6_ATON&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href=&#34;../../../../../en/sql-reference/functions/data-type-specific-functions/ip-address-functions/v6-ntoa/#&#34;&gt;V6_NTOA&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href=&#34;../../../../../en/sql-reference/functions/data-type-specific-functions/ip-address-functions/v6-subneta/#&#34;&gt;V6_SUBNETA&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href=&#34;../../../../../en/sql-reference/functions/data-type-specific-functions/ip-address-functions/v6-subnetn/#&#34;&gt;V6_SUBNETN&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href=&#34;../../../../../en/sql-reference/functions/data-type-specific-functions/ip-address-functions/v6-type/#&#34;&gt;V6_TYPE&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

      </description>
    </item>
    
    <item>
      <title>Sql-Reference: INET_NTOA</title>
      <link>/en/sql-reference/functions/data-type-specific-functions/ip-address-functions/inet-ntoa/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>/en/sql-reference/functions/data-type-specific-functions/ip-address-functions/inet-ntoa/</guid>
      <description>
        
        
        &lt;p&gt;Converts an INTEGER value into a VARCHAR dotted-quad representation of an IPv4 network address. INET_NTOA returns NULL if the integer value is NULL, negative, or is greater than 2&lt;sup&gt;32&lt;/sup&gt; (4294967295).&lt;/p&gt;
&lt;h2 id=&#34;behavior-type&#34;&gt;Behavior type&lt;/h2&gt;
&lt;a class=&#34;glosslink&#34; href=&#34;../../../../../en/glossary/immutable-invariant-functions/&#34; title=&#34;&#34;&gt;Immutable&lt;/a&gt;
&lt;h2 id=&#34;syntax&#34;&gt;Syntax&lt;/h2&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;INET_NTOA ( &lt;span class=&#34;code-variable&#34;&gt;expression&lt;/span&gt; )
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;arguments&#34;&gt;Arguments&lt;/h2&gt;
&lt;dl&gt;
&lt;dt&gt;&lt;em&gt;&lt;code&gt;expression&lt;/code&gt;&lt;/em&gt;&lt;/dt&gt;
&lt;dd&gt;The integer network address to convert.&lt;/dd&gt;
&lt;/dl&gt;
&lt;h2 id=&#34;examples&#34;&gt;Examples&lt;/h2&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; SELECT INET_NTOA(16909060);
 inet_ntoa
-----------
 1.2.3.4
(1 row)

=&amp;gt; SELECT INET_NTOA(03021962);
 inet_ntoa
-------------
 0.46.28.138
(1 row)
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;see-also&#34;&gt;See also&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;a href=&#34;../../../../../en/sql-reference/functions/data-type-specific-functions/ip-address-functions/inet-aton/#&#34;&gt;INET_ATON&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href=&#34;../../../../../en/sql-reference/functions/data-type-specific-functions/ip-address-functions/v6-aton/#&#34;&gt;V6_ATON&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href=&#34;../../../../../en/sql-reference/functions/data-type-specific-functions/ip-address-functions/v6-ntoa/#&#34;&gt;V6_NTOA&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href=&#34;../../../../../en/sql-reference/functions/data-type-specific-functions/ip-address-functions/v6-subneta/#&#34;&gt;V6_SUBNETA&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href=&#34;../../../../../en/sql-reference/functions/data-type-specific-functions/ip-address-functions/v6-subnetn/#&#34;&gt;V6_SUBNETN&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href=&#34;../../../../../en/sql-reference/functions/data-type-specific-functions/ip-address-functions/v6-type/#&#34;&gt;V6_TYPE&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

      </description>
    </item>
    
    <item>
      <title>Sql-Reference: V6_ATON</title>
      <link>/en/sql-reference/functions/data-type-specific-functions/ip-address-functions/v6-aton/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>/en/sql-reference/functions/data-type-specific-functions/ip-address-functions/v6-aton/</guid>
      <description>
        
        
        &lt;p&gt;Converts a string containing a colon-delimited IPv6 network address into a VARBINARY string. Any spaces around the IPv6 address are trimmed. This function returns NULL if the input value is NULL or it cannot be parsed as an IPv6 address. This function relies on the Linux function &lt;a href=&#34;http://www.opengroup.org/onlinepubs/000095399/functions/inet_ntop.html&#34;&gt;inet_pton&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&#34;behavior-type&#34;&gt;Behavior type&lt;/h2&gt;
&lt;a class=&#34;glosslink&#34; href=&#34;../../../../../en/glossary/immutable-invariant-functions/&#34; title=&#34;&#34;&gt;Immutable&lt;/a&gt;
&lt;h2 id=&#34;syntax&#34;&gt;Syntax&lt;/h2&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;V6_ATON ( &lt;span class=&#34;code-variable&#34;&gt;expression&lt;/span&gt; )
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;arguments&#34;&gt;Arguments&lt;/h2&gt;
&lt;dl&gt;
&lt;dt&gt;&lt;em&gt;&lt;code&gt;expression&lt;/code&gt;&lt;/em&gt;&lt;/dt&gt;
&lt;dd&gt;(VARCHAR) the string containing an IPv6 address to convert.&lt;/dd&gt;
&lt;/dl&gt;
&lt;h2 id=&#34;examples&#34;&gt;Examples&lt;/h2&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; SELECT V6_ATON(&amp;#39;2001:DB8::8:800:200C:417A&amp;#39;);
                       v6_aton
------------------------------------------------------
  \001\015\270\000\000\000\000\000\010\010\000 \014Az
(1 row)

=&amp;gt; SELECT V6_ATON(&amp;#39;1.2.3.4&amp;#39;);
              v6_aton
------------------------------------------------------------------
 \000\000\000\000\000\000\000\000\000\000\377\377\001\002\003\004
(1 row)
SELECT TO_HEX(V6_ATON(&amp;#39;2001:DB8::8:800:200C:417A&amp;#39;));
              to_hex
----------------------------------
 20010db80000000000080800200c417a
(1 row)

=&amp;gt; SELECT V6_ATON(&amp;#39;::1.2.3.4&amp;#39;);
              v6_aton
------------------------------------------------------------------
 \000\000\000\000\000\000\000\000\000\000\000\000\001\002\003\004
(1 row)
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;see-also&#34;&gt;See also&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;a href=&#34;../../../../../en/sql-reference/functions/data-type-specific-functions/ip-address-functions/v6-ntoa/#&#34;&gt;V6_NTOA&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href=&#34;../../../../../en/sql-reference/functions/data-type-specific-functions/ip-address-functions/v6-subneta/#&#34;&gt;V6_SUBNETA&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href=&#34;../../../../../en/sql-reference/functions/data-type-specific-functions/ip-address-functions/v6-subnetn/#&#34;&gt;V6_SUBNETN&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href=&#34;../../../../../en/sql-reference/functions/data-type-specific-functions/ip-address-functions/v6-type/#&#34;&gt;V6_TYPE&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href=&#34;../../../../../en/sql-reference/functions/data-type-specific-functions/ip-address-functions/inet-aton/#&#34;&gt;INET_ATON&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href=&#34;../../../../../en/sql-reference/functions/data-type-specific-functions/ip-address-functions/inet-ntoa/#&#34;&gt;INET_NTOA&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

      </description>
    </item>
    
    <item>
      <title>Sql-Reference: V6_NTOA</title>
      <link>/en/sql-reference/functions/data-type-specific-functions/ip-address-functions/v6-ntoa/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>/en/sql-reference/functions/data-type-specific-functions/ip-address-functions/v6-ntoa/</guid>
      <description>
        
        
        &lt;p&gt;Converts an IPv6 address represented as varbinary to a character string.&lt;/p&gt;
&lt;h2 id=&#34;behavior-type&#34;&gt;Behavior type&lt;/h2&gt;
&lt;a class=&#34;glosslink&#34; href=&#34;../../../../../en/glossary/immutable-invariant-functions/&#34; title=&#34;&#34;&gt;Immutable&lt;/a&gt;
&lt;h2 id=&#34;syntax&#34;&gt;Syntax&lt;/h2&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;V6_NTOA ( &lt;span class=&#34;code-variable&#34;&gt;expression&lt;/span&gt; )
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;arguments&#34;&gt;Arguments&lt;/h2&gt;
&lt;dl&gt;
&lt;dt&gt;&lt;code&gt;&lt;span class=&#34;code-variable&#34;&gt;expression&lt;/span&gt;&lt;/code&gt;&lt;/dt&gt;
&lt;dd&gt;(&lt;code&gt;VARBINARY&lt;/code&gt;) is the binary string to convert.&lt;/dd&gt;
&lt;/dl&gt;
&lt;h2 id=&#34;notes&#34;&gt;Notes&lt;/h2&gt;
&lt;p&gt;The following syntax converts an IPv6 address represented as &lt;code&gt;VARBINARY&lt;/code&gt; B to a string A.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;V6_NTOA&lt;/code&gt; right-pads B to 16 bytes with zeros, if necessary, and calls the Linux function &lt;a href=&#34;http://www.opengroup.org/onlinepubs/000095399/functions/inet_ntop.html&#34;&gt;inet_ntop&lt;/a&gt;.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; V6_NTOA(VARBINARY B) -&amp;gt; VARCHAR A
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;If B is NULL or longer than 16 bytes, the result is NULL.&lt;/p&gt;
&lt;p&gt;OpenText™ Analytics Database automatically converts the form &#39;::ffff:1.2.3.4&#39; to &#39;1.2.3.4&#39;.&lt;/p&gt;
&lt;h2 id=&#34;examples&#34;&gt;Examples&lt;/h2&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; SELECT V6_NTOA(&amp;#39; \001\015\270\000\000\000\000\000\010\010\000 \014Az&amp;#39;);
          v6_ntoa
---------------------------
 2001:db8::8:800:200c:417a
(1 row)

=&amp;gt; SELECT V6_NTOA(V6_ATON(&amp;#39;1.2.3.4&amp;#39;));
 v6_ntoa
---------
 1.2.3.4
(1 row)

=&amp;gt; SELECT V6_NTOA(V6_ATON(&amp;#39;::1.2.3.4&amp;#39;));
  v6_ntoa
-----------
 ::1.2.3.4
(1 row)
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;see-also&#34;&gt;See also&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;../../../../../en/sql-reference/functions/data-type-specific-functions/ip-address-functions/v6-aton/#&#34;&gt;V6_ATON&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

      </description>
    </item>
    
    <item>
      <title>Sql-Reference: V6_SUBNETA</title>
      <link>/en/sql-reference/functions/data-type-specific-functions/ip-address-functions/v6-subneta/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>/en/sql-reference/functions/data-type-specific-functions/ip-address-functions/v6-subneta/</guid>
      <description>
        
        
        &lt;p&gt;Returns a VARCHAR containing a subnet address in CIDR (Classless Inter-Domain Routing) format from a binary or alphanumeric IPv6 address. Returns NULL if either parameter is NULL, the address cannot be parsed as an IPv6 address, or the subnet value is outside the range of 0 to 128.&lt;/p&gt;
&lt;h2 id=&#34;behavior-type&#34;&gt;Behavior type&lt;/h2&gt;
&lt;a class=&#34;glosslink&#34; href=&#34;../../../../../en/glossary/immutable-invariant-functions/&#34; title=&#34;&#34;&gt;Immutable&lt;/a&gt;
&lt;h2 id=&#34;syntax&#34;&gt;Syntax&lt;/h2&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;V6_SUBNETA ( &lt;span class=&#34;code-variable&#34;&gt;address&lt;/span&gt;, &lt;span class=&#34;code-variable&#34;&gt;subnet&lt;/span&gt;)
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;arguments&#34;&gt;Arguments&lt;/h2&gt;
&lt;dl&gt;
&lt;dt&gt;&lt;em&gt;&lt;code&gt;address&lt;/code&gt;&lt;/em&gt;&lt;/dt&gt;
&lt;dd&gt;VARBINARY or VARCHAR containing the IPv6 address.&lt;/dd&gt;
&lt;dt&gt;&lt;em&gt;&lt;code&gt;subnet&lt;/code&gt;&lt;/em&gt;&lt;/dt&gt;
&lt;dd&gt;The size of the subnet in bits as an INTEGER. This value must be greater than zero and less than or equal to 128.&lt;/dd&gt;
&lt;/dl&gt;
&lt;h2 id=&#34;examples&#34;&gt;Examples&lt;/h2&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; SELECT V6_SUBNETA(V6_ATON(&amp;#39;2001:db8::8:800:200c:417a&amp;#39;), 28);
  v6_subneta
---------------
 2001:db0::/28
(1 row)
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;see-also&#34;&gt;See also&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;a href=&#34;../../../../../en/sql-reference/functions/data-type-specific-functions/ip-address-functions/v6-aton/#&#34;&gt;V6_ATON&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href=&#34;../../../../../en/sql-reference/functions/data-type-specific-functions/ip-address-functions/v6-ntoa/#&#34;&gt;V6_NTOA&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href=&#34;../../../../../en/sql-reference/functions/data-type-specific-functions/ip-address-functions/v6-subnetn/#&#34;&gt;V6_SUBNETN&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href=&#34;../../../../../en/sql-reference/functions/data-type-specific-functions/ip-address-functions/v6-type/#&#34;&gt;V6_TYPE&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href=&#34;../../../../../en/sql-reference/functions/data-type-specific-functions/ip-address-functions/inet-aton/#&#34;&gt;INET_ATON&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href=&#34;../../../../../en/sql-reference/functions/data-type-specific-functions/ip-address-functions/inet-ntoa/#&#34;&gt;INET_NTOA&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

      </description>
    </item>
    
    <item>
      <title>Sql-Reference: V6_SUBNETN</title>
      <link>/en/sql-reference/functions/data-type-specific-functions/ip-address-functions/v6-subnetn/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>/en/sql-reference/functions/data-type-specific-functions/ip-address-functions/v6-subnetn/</guid>
      <description>
        
        
        &lt;p&gt;Calculates a subnet address in CIDR (Classless Inter-Domain Routing) format from a varbinary or alphanumeric IPv6 address.&lt;/p&gt;
&lt;h2 id=&#34;behavior-type&#34;&gt;Behavior type&lt;/h2&gt;
&lt;a class=&#34;glosslink&#34; href=&#34;../../../../../en/glossary/immutable-invariant-functions/&#34; title=&#34;&#34;&gt;Immutable&lt;/a&gt;
&lt;h2 id=&#34;syntax&#34;&gt;Syntax&lt;/h2&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;V6_SUBNETN ( &lt;span class=&#34;code-variable&#34;&gt;address&lt;/span&gt;, &lt;span class=&#34;code-variable&#34;&gt;subnet-size&lt;/span&gt;)
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;arguments&#34;&gt;Arguments&lt;/h2&gt;
&lt;dl&gt;
&lt;dt&gt;&lt;em&gt;&lt;code&gt;address&lt;/code&gt;&lt;/em&gt;&lt;/dt&gt;
&lt;dd&gt;The IPv6 address as a VARBINARY or VARCHAR. The format you pass in determines the date type of the output. If you pass in a VARBINARY address, V6_SUBNETN returns a VARBINARY value. If you pass in a VARCHAR value, it returns a VARCHAR.&lt;/dd&gt;
&lt;dt&gt;&lt;em&gt;&lt;code&gt;subnet-size&lt;/code&gt;&lt;/em&gt;&lt;/dt&gt;
&lt;dd&gt;The size of the subnet as an INTEGER.&lt;/dd&gt;
&lt;/dl&gt;
&lt;h2 id=&#34;notes&#34;&gt;Notes&lt;/h2&gt;
&lt;p&gt;The following syntax masks a BINARY IPv6 address &lt;code&gt;B&lt;/code&gt; so that the N left-most bits of &lt;code&gt;S&lt;/code&gt; form a subnet address, while the remaining right-most bits are cleared.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;V6_SUBNETN&lt;/code&gt; right-pads &lt;code&gt;B&lt;/code&gt; to 16 bytes with zeros, if necessary and masks &lt;code&gt;B&lt;/code&gt;, preserving its N-bit subnet prefix.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; V6_SUBNETN(VARBINARY B, INT8 N) -&amp;gt; VARBINARY(16) S
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;If &lt;code&gt;B&lt;/code&gt; is NULL or longer than 16 bytes, or if &lt;code&gt;N&lt;/code&gt; is not between 0 and 128 inclusive, the result is NULL.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;S = [B]/N&lt;/code&gt; in &lt;a href=&#34;http://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing&#34;&gt;Classless Inter-Domain Routing&lt;/a&gt; notation (CIDR notation).&lt;/p&gt;
&lt;p&gt;The following syntax masks an alphanumeric IPv6 address &lt;code&gt;A&lt;/code&gt; so that the &lt;code&gt;N&lt;/code&gt; leftmost bits form a subnet address, while the remaining rightmost bits are cleared.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; V6_SUBNETN(VARCHAR A, INT8 N) -&amp;gt; V6_SUBNETN(V6_ATON(A), N) -&amp;gt; VARBINARY(16) S
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;examples&#34;&gt;Examples&lt;/h2&gt;
&lt;p&gt;This example returns VARBINARY, after using V6_ATON to convert the VARCHAR string to VARBINARY:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; SELECT V6_SUBNETN(V6_ATON(&amp;#39;2001:db8::8:800:200c:417a&amp;#39;), 28);
                           v6_subnetn
---------------------------------------------------------------
  \001\015\260\000\000\000\000\000\000\000\000\000\000\000\000
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;see-also&#34;&gt;See also&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;a href=&#34;../../../../../en/sql-reference/functions/data-type-specific-functions/ip-address-functions/v6-aton/#&#34;&gt;V6_ATON&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href=&#34;../../../../../en/sql-reference/functions/data-type-specific-functions/ip-address-functions/v6-ntoa/#&#34;&gt;V6_NTOA&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href=&#34;../../../../../en/sql-reference/functions/data-type-specific-functions/ip-address-functions/v6-type/#&#34;&gt;V6_TYPE&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href=&#34;../../../../../en/sql-reference/functions/data-type-specific-functions/ip-address-functions/v6-subneta/#&#34;&gt;V6_SUBNETA&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href=&#34;../../../../../en/sql-reference/functions/data-type-specific-functions/ip-address-functions/inet-aton/#&#34;&gt;INET_ATON&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href=&#34;../../../../../en/sql-reference/functions/data-type-specific-functions/ip-address-functions/inet-ntoa/#&#34;&gt;INET_NTOA&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

      </description>
    </item>
    
    <item>
      <title>Sql-Reference: V6_TYPE</title>
      <link>/en/sql-reference/functions/data-type-specific-functions/ip-address-functions/v6-type/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>/en/sql-reference/functions/data-type-specific-functions/ip-address-functions/v6-type/</guid>
      <description>
        
        
        &lt;p&gt;Returns an INTEGER value that classifies the type of the network address passed to it as defined in &lt;a href=&#34;https://datatracker.ietf.org/doc/html/rfc4291#section-2.4&#34;&gt;IETF RFC 4291 section 2.4&lt;/a&gt;. For example, If you pass this function the string &lt;code&gt;127.0.0.1&lt;/code&gt;, it returns 2 which indicates the address is a loopback address. This function accepts both IPv4 and IPv6 addresses.&lt;/p&gt;
&lt;h2 id=&#34;behavior-type&#34;&gt;Behavior type&lt;/h2&gt;
&lt;a class=&#34;glosslink&#34; href=&#34;../../../../../en/glossary/immutable-invariant-functions/&#34; title=&#34;&#34;&gt;Immutable&lt;/a&gt;
&lt;h2 id=&#34;syntax&#34;&gt;Syntax&lt;/h2&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;V6_TYPE ( &lt;span class=&#34;code-variable&#34;&gt;address&lt;/span&gt;)
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;arguments&#34;&gt;Arguments&lt;/h2&gt;
&lt;dl&gt;
&lt;dt&gt;&lt;em&gt;&lt;code&gt;address&lt;/code&gt;&lt;/em&gt;&lt;/dt&gt;
&lt;dd&gt;A VARBINARY or VARCHAR containing an IPv6 or IPv4 address to describe.&lt;/dd&gt;
&lt;/dl&gt;
&lt;h2 id=&#34;returns&#34;&gt;Returns&lt;/h2&gt;
&lt;p&gt;The values returned by this function are:

&lt;table class=&#34;table table-bordered&#34; &gt;



&lt;tr&gt; 

&lt;th &gt;
Return Value&lt;/th&gt; 

&lt;th &gt;
Address Type&lt;/th&gt; 

&lt;th &gt;
Description&lt;/th&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;
0&lt;/td&gt; 

&lt;td &gt;
GLOBAL&lt;/td&gt; 

&lt;td &gt;
Global unicast addresses&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;
1&lt;/td&gt; 

&lt;td &gt;
LINKLOCAL&lt;/td&gt; 

&lt;td &gt;
Link-Local unicast (and private-use) addresses&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;
2&lt;/td&gt; 

&lt;td &gt;
LOOPBACK&lt;/td&gt; 

&lt;td &gt;
Loopback addresses&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;
3&lt;/td&gt; 

&lt;td &gt;
UNSPECIFIED&lt;/td&gt; 

&lt;td &gt;
Unspecifiedaddresses&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;
4&lt;/td&gt; 

&lt;td &gt;
MULTICAST&lt;/td&gt; 

&lt;td &gt;
Multicastaddresses&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/p&gt;
&lt;p&gt;The return value is based on the following table of IP address ranges:

&lt;table class=&#34;table table-bordered&#34; &gt;



&lt;tr&gt; 

&lt;th &gt;
Address Family&lt;/th&gt; 

&lt;th &gt;
CIDR&lt;/th&gt; 

&lt;th &gt;
Type&lt;/th&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td  rowspan=&#34;8&#34; &gt;
IPv4&lt;/td&gt; 

&lt;td &gt;
0.0.0.0/8&lt;/td&gt; 

&lt;td &gt;
UNSPECIFIED&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;
10.0.0.0/8&lt;/td&gt; 

&lt;td &gt;
LINKLOCAL&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;
127.0.0.0/8&lt;/td&gt; 

&lt;td &gt;
LOOPBACK&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;
169.254.0.0/16&lt;/td&gt; 

&lt;td &gt;
LINKLOCAL&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;
172.16.0.0/12&lt;/td&gt; 

&lt;td &gt;
LINKLOCAL&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;
192.168.0.0/16&lt;/td&gt; 

&lt;td &gt;
LINKLOCAL&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;
224.0.0.0/4&lt;/td&gt; 

&lt;td &gt;
MULTICAST&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;
All other addresses&lt;/td&gt; 

&lt;td &gt;
GLOBAL&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td  rowspan=&#34;5&#34; &gt;
IPv6&lt;/td&gt; 

&lt;td &gt;
::0/128&lt;/td&gt; 

&lt;td &gt;
UNSPECIFIED&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;
::1/128&lt;/td&gt; 

&lt;td &gt;
LOOPBACK&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;
fe80::/10&lt;/td&gt; 

&lt;td &gt;
LINKLOCAL&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;
ff00::/8&lt;/td&gt; 

&lt;td &gt;
MULTICAST&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;
All other addresses&lt;/td&gt; 

&lt;td &gt;
GLOBAL&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/p&gt;
&lt;p&gt;This function returns NULL if you pass it a NULL value or an invalid address.&lt;/p&gt;
&lt;h2 id=&#34;examples&#34;&gt;Examples&lt;/h2&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; SELECT V6_TYPE(V6_ATON(&amp;#39;192.168.2.10&amp;#39;));
 v6_type
---------
       1
(1 row)

=&amp;gt; SELECT V6_TYPE(V6_ATON(&amp;#39;2001:db8::8:800:200c:417a&amp;#39;));
 v6_type
---------
       0
(1 row)
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;see-also&#34;&gt;See also&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;a href=&#34;../../../../../en/sql-reference/functions/data-type-specific-functions/ip-address-functions/v6-aton/#&#34;&gt;V6_ATON&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href=&#34;../../../../../en/sql-reference/functions/data-type-specific-functions/ip-address-functions/v6-ntoa/#&#34;&gt;V6_NTOA&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href=&#34;../../../../../en/sql-reference/functions/data-type-specific-functions/ip-address-functions/inet-aton/#&#34;&gt;INET_ATON&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href=&#34;../../../../../en/sql-reference/functions/data-type-specific-functions/ip-address-functions/inet-ntoa/#&#34;&gt;INET_NTOA&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href=&#34;../../../../../en/sql-reference/functions/data-type-specific-functions/ip-address-functions/v6-subnetn/#&#34;&gt;V6_SUBNETN&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href=&#34;../../../../../en/sql-reference/functions/data-type-specific-functions/ip-address-functions/v6-subneta/#&#34;&gt;V6_SUBNETA&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&#34;http://www.ietf.org/rfc/rfc4291&#34;&gt;IP Version 6 Addressing Architecture&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&#34;http://www.iana.org/assignments/ipv4-address-space/ipv4-address-space.xml&#34;&gt;IPv4 Global Unicast Address Assignments&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;

      </description>
    </item>
    
  </channel>
</rss>
