Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update the introduction to UCASE() and UNHEX() #16533

Merged
merged 9 commits into from
Feb 27, 2024
Merged
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 42 additions & 2 deletions functions-and-operators/string-functions.md
Original file line number Diff line number Diff line change
Expand Up @@ -1388,11 +1388,51 @@ Remove leading and trailing spaces.

### [`UCASE()`](https://dev.mysql.com/doc/refman/8.0/en/string-functions.html#function_ucase)

Synonym for `UPPER()`.
The `UCASE()` function is used to convert a string to uppercase letters. This function is equivalent to the `UPPER()` function.

> **Note:**
>
> When the string is `NULL`, the `UCASE()` function returns `NULL`.
lilin90 marked this conversation as resolved.
Show resolved Hide resolved

Example:

```sql
SELECT upper('bigdata') AS result_upper, upper('null') AS result_null;
lilin90 marked this conversation as resolved.
Show resolved Hide resolved
lilin90 marked this conversation as resolved.
Show resolved Hide resolved
```

Output:

```sql
+--------------+-------------+
| result_upper | result_null |
+--------------+-------------+
| BIGDATA | NULL |
+--------------+-------------+
```

### [`UNHEX()`](https://dev.mysql.com/doc/refman/8.0/en/string-functions.html#function_unhex)

Return a string containing hex representation of a number.
The `UNHEX()` function performs the reverse operation of the `HEX()` function. It treats each pair of characters in the argument as a hexadecimal number and converts it to the character represented by that number, returning the result as a binary string.

> **Note:**
>
> The argument must be a valid hexadecimal value that contains `0`~`9`, `A`~`F`, or `a`~`f`. If the argument is `NULL` or falls outside this range, the function returns `NULL`.
lilin90 marked this conversation as resolved.
Show resolved Hide resolved

qiancai marked this conversation as resolved.
Show resolved Hide resolved
Example:

```sql
SELECT UNHEX('54694442');
```

Output:

```sql
+--------------------------------------+
| UNHEX('54694442') |
+--------------------------------------+
| 0x54694442 |
+--------------------------------------+
```

### [`UPPER()`](https://dev.mysql.com/doc/refman/8.0/en/string-functions.html#function_upper)

Expand Down
Loading