共用方式為


url_encode 函式

適用於:檢查標示為是 Databricks SQL 檢查標示為是 Databricks Runtime 11.3 LTS 和更新版本

將字串轉譯為 application/x-www-form-urlencoded 格式。

語法

url_encode(str)

引數

  • str:要編碼的 STRING 運算式。

傳回

STRING符合 application/x-www-form-urlencoded (www.w3.org) 格式的規範:

範例

> 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(url_decode('http%3A%2F%2Fspark.apache.org%2Fpath%3Fquery%3D1'), 'HOST');
 1