Network Type Functions
The IPV4 data type is castable to IP. The returned value is the IPV6-mapped IPV4 address, which has the form ::ffff:x.x.x.x.
Syntax
Argument | Data Type | Description |
ipv4_col | IPV4 | Returns the IPV6-mapped IPV4 address. |
Example
Output
You can only cast the IP data type to IPV4 if the IPV6 value has an IPV4 semantic equivalent. The database can convert these IPV6 address formats to IPV4:
- IPV4-compatible IPV6 ::x.x.x.x
- IPV6-mapped IPV4 ::ffff:x.x.x.x
- NAT64-prefixed 64:ff9b::x.x.x.x
Syntax
Argument | Data Type | Description |
ip_col | IP | Returns the IPV4 portion of the IPV6 address. If the IPV6 address is not IPV4-compatible, IPV6-mapped, or NAT64, the cast returns an INVALID DATA TYPE CONVERSION error. |
Example
Output
The IS_IPV4 Boolean function tests whether the database can convert the IP value to the IPV4 data type. The database can convert these IPV6 address formats to IPV4:
- IPV4-compatible IPV6 ::x.x.x.x
- IPV6-mapped IPV4 ::ffff:x.x.x.x
- NAT64-prefixed 64:ff9b::x.x.x.x
Syntax
Argument | Data Type | Description |
ip_col | IP | Denotes whether the database can convert the specified IP value to the IPV4 data type with return values true or false. |
Example
Output
The SUBNET function computes the prefix from an IP or IPV4 value and the size of the prefix. The function returns a value of the same type as ip_col.
Syntax
Argument | Data Type | Description |
ip_col | IP, IPV4 | The IP address from which to calculate the prefix. |
prefix_size | Integral | The size of the subnet network prefix. For IPV4 addresses, the size must be in [0, 32], and for IP addresses, the size must be in [0, 128]. If the prefix exceeds these range values, the function returns an INVALID ARGUMENT error. |
Example
Output
Data Types