Purpose
CONVERT() converts a string from one character set to another.
Syntax
CONVERT(char, dest_char_set[, source_char_set])
Parameters
| Parameter | Description |
|---|---|
| char | The string to be converted. It can be of any data type, such as CHAR, VARCHAR2, NCHAR, NVARCHAR2, and CLOB. |
| dest_char_set | The name of the character set to which the string is converted. |
| source_char_set | The name of character set that is used to store the string in the database. If you do not specify this parameter, its default value is the database character set. |
Return type
If
charis of theCHARorVARCHAR2data type, the return type isVARCHAR2.If
charis of theNCHARorNVARCHAR2data type, the return type isNVARCHAR2.If
charis of theCLOBdata type, the return type isCLOB.
Examples
The following example converts the string Ä Ê Í a B c d to a string of the ZHS16GBK character set.
obclient> SELECT CONVERT('Ä Ê Í a b c d', 'ZHS16GBK') FROM DUAL;
+----------------------------------+
| CONVERT('ÄÊÍABCD','ZHS16GBK') |
+----------------------------------+
| ? ? ? a b c d |
+----------------------------------+
1 row in set