Purpose
This function decodes a URL-encoded string into its original form. It converts the % followed by two hexadecimal digits in expr back to 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 only supports the
utf8character set. - If the input is of the
stringtype, the output collation remains the same as the input. If the input is not of thestringtype, the output collation is 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 the
VARCHARtype. - 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
