CONVERT()

Overview

Converts the given value from one character set encoding to another.

USAGE

CONVERT(string USING charset)

Argument Name

Description

string

The string to convert

charset

The desired character set to use

DETAILS

CONVERT() is a type-conversion function that converts a string from one character set encoding to another.

The CONVERT(expr USING charset) syntax converts a string into the specified character set encoding.

A NULL is returned if the string argument is NULL.

SYNONYMS

SCHEMA

PARAMETERS

SKYSQL

PRIVILEGES

EXAMPLES

SELECT CONVERT('mariadb' USING utf8mb4);
+----------------------------------+
| CONVERT('mariadb' USING utf8mb4) |
+----------------------------------+
| mariadb                          |
+----------------------------------+

ERROR HANDLING

Unknown character set

The CONVERT() function requires a known character set to be specified after the USING clause. If an unknown name is specified, the following error is generated:

SELECT CONVERT('A' USING foo);
ERROR 1115 (HY000): [28674] Invalid character set/collation: Cannot find charset foo

FEATURE INTERACTION

RESPONSES

DIAGNOSIS

ISO 9075:2016

CHANGE HISTORY

Release Series

History

23.09

  • Present starting in MariaDB Xpand 23.09.1.

6.1

  • Present starting in MariaDB Xpand 6.1.0.

6.0

  • Present starting in MariaDB Xpand 6.0.3.

5.3

  • Present starting in MariaDB Xpand 5.3.13.

Release Series

History

6.0

  • Present starting in MariaDB Xpand 6.0.3.

5.3

  • Present starting in MariaDB Xpand 5.3.13.

Release Series

History

6.1

  • Present starting in MariaDB Xpand 6.1.0.

EXTERNAL REFERENCES