Purpose
This function is used to decode a URL-encoded string into its original form. It decodes the % followed by two hexadecimal digits in expr into the corresponding character. URL_ENCODE and URL_DECODE are inverse operations.
Note
This function is supported starting from OceanBase Database V4.3.5 BP1.
Limitations and considerations
- This function currently only supports the
utf8character set. - If the input is of type
string, the output collation remains consistent with the input. If the input is not of typestring, the output collation will use the default collation of the current session.
Syntax
URL_DECODE(expr)
Parameters
expr: the string to be URL-decoded.
Return type
- Returns a URL-decoded string of type
VARCHAR. - Returns
NULLifexprisNULL.
Examples
SELECT URL_DECODE('https%3A%2F%2Fexample.com%2Fpath%3Fname%3DJohn+Doe%26age%3D25'), URL_DECODE(NULL);
The execution result is as follows:
+-----------------------------------------------------------------------------+------------------+
| URL_DECODE('https%3A%2F%2Fexample.com%2Fpath%3Fname%3DJohn+Doe%26age%3D25') | URL_DECODE(NULL) |
+-----------------------------------------------------------------------------+------------------+
| https://example.com/path?name=John+Doe&age=25 | NULL |
+-----------------------------------------------------------------------------+------------------+
1 row in set