Purpose
This function is used to decode 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. - When 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. - If
exprisNULL, it returnsNULL.
Examples
SELECT URL_DECODE('https%3A%2F%2Fexample.com%2Fpath%3Fname%3DJohn+Doe%26age%3D25'), URL_DECODE(NULL);
The return 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