Skip to main content
Parses a URL and extracts a component from this URL.

Syntax

Parameters

expr1: the URL. The supported data type is VARCHAR. expr2: the component to extract from this URL. The supported data type is VARCHAR. Valid values:
  • PROTOCOL
  • HOST
  • PATH
  • REF
  • AUTHORITY
  • FILE
  • USERINFO
  • QUERY. Parameters in QUERY cannot be returned. If you want to return specific parameters, use parse_url with trim to achieve this implementation. For details, see Examples.
expr2 is case-sensitive.

Return value

Returns a value of the VARCHAR type. If the URL is invalid, an error is returned. If the requested information cannot be find, NULL is returned.

Examples

Text