Lưu ý
Cần có ủy quyền mới truy nhập được vào trang này. Bạn có thể thử đăng nhập hoặc thay đổi thư mục.
Cần có ủy quyền mới truy nhập được vào trang này. Bạn có thể thử thay đổi thư mục.
Applies to:
Databricks Runtime 18.2 and above
Important
This feature is in Beta. Workspace admins can control access to this feature from the Previews page. See Manage Azure Databricks previews.
Returns the canonical string representation of an IP address or CIDR block.
Syntax
ip_as_string ( ip_or_cidr )
Arguments
ip_or_cidr: ASTRINGorBINARYvalue representing an IPv4 or IPv6 address or CIDR block.
Returns
A STRING representing the canonical string form of the IP address or CIDR block. For BINARY inputs, the binary representation is converted to its equivalent string form.
The function returns NULL if the input is NULL.
Error conditions
- If the input is not a valid IP address or CIDR block, the function returns INVALID_IP_ADDRESS_OR_CIDR_BLOCK.
Examples
> SELECT ip_as_string('192.168.1.1');
192.168.1.1
> SELECT ip_as_string('2001:0db8:0000:0000:0000:0000:0000:0001');
2001:db8::1
> SELECT ip_as_string('192.168.1.5/24');
192.168.1.0/24
> SELECT ip_as_string(X'C0A80101');
192.168.1.1
> SELECT ip_as_string(X'20010DB8000000000000000000000001');
2001:db8::1
> SELECT ip_as_string(NULL);
NULL
> SELECT ip_as_string('invalid.ip');
Error: INVALID_IP_ADDRESS_OR_CIDR_BLOCK