url_decode function (Databricks SQL)

Translates a string back from application/x-www-form-urlencoded format.

Requires: SQL warehouse version 2022.35 or higher. This version is available in the Preview channel.

Syntax

url_decode(str)

Arguments

  • str: A STRING expression to decode.

Returns

A STRING.

If the string does not comply with the application/x-www-form-urlencoded format, the function returns and error.

Examples

> SELECT url_encode('http://spark.apache.org/path?query=1');
 http%3A%2F%2Fspark.apache.org%2Fpath%3Fquery%3D1

> SELECT url_decode('http%3A%2F%2Fspark.apache.org%2Fpath%3Fquery%3D1');
 http://spark.apache.org/path?query=1

> SELECT url_decode('http%3A%2F%2spark.apache.org');
 Error: Illegal argument

> SELECT parse_url('http://spark.apache.org/path?query=1', 'QUERY', 'query');
 1

> SELECT parse_url('http%3A%2F%2Fspark.apache.org%2Fpath%3Fquery%3D1', 'QUERY', 'query');
 1