Skip to main content

PROTOCOL

Description

The PROTOCOL function is mainly used to extract the protocol part from a URL string.

Syntax

PROTOCOL( <url> )

Parameters

ParameterDescription
<url>The URL to be parsed

Return Value

Returns the protocol part of the . Special cases:

  • If any of the parameters is NULL, NULL is returned.

Examples

SELECT protocol('https://doris.apache.org/');
+---------------------------------------+
| protocol('https://doris.apache.org/') |
+---------------------------------------+
| https |
+---------------------------------------+
SELECT protocol(null);
+----------------+
| protocol(NULL) |
+----------------+
| NULL |
+----------------+

相关命令

If you want to extract other parts of the URL, you can use parse_url