<<<<<<< HEAD stringdecode | H2 | SQLDoc
Skip to main content

stringdecode

1. STRINGDECODE Function

======= stringdecode | H2 Function | SQLDoc

stringdecode

1. STRINGDECODE Function

>>>>>>> 9d19b1c8cb744c8e86d5c15b74d8b5f719ad62be

The STRINGDECODE function in H2 database is used to decode a URL-encoded string.

2. Syntax

The syntax for the STRINGDECODE function in H2 database is as follows:

STRINGDECODE(str)

Arguments

  • str: The URL-encoded string that needs to be decoded. It should be a string or a column of string type.

Return

  • The STRINGDECODE function returns the decoded string.

3. Notes

  • The STRINGDECODE function in H2 database decodes a URL-encoded string by replacing any URL-encoded characters with their respective character representation.
  • If the input string is not a valid URL-encoded string, the function will still return the string as is.
  • Remember to use the correct syntax and datatype while using the STRINGDECODE function to avoid errors.

4. Examples

Here are a few examples demonstrating the usage of the STRINGDECODE function in H2 database:

Example 1 - Decoding a URL-encoded string:

SELECT STRINGDECODE('Hello%20World') AS decoded_string;

Output:

decoded_string
--------------
Hello World

Example 2 - Decoding a URL-encoded string stored in a column:

CREATE TABLE encoded_strings (
id INT PRIMARY KEY,
encoded_string VARCHAR(100)
);

INSERT INTO encoded_strings VALUES (1, 'Hello%20World'), (2, 'H2%20Database');

SELECT id, encoded_string, STRINGDECODE(encoded_string) AS decoded_string
FROM encoded_strings;

Output:

id | encoded_string | decoded_string
---+----------------+----------------
1 | Hello%20World | Hello World
2 | H2%20Database | H2 Database