Description
The Oracle/PLSQL: CONVERT function converts a string from one character set to another. The only practical use of the function is to correct data that has been stored in a wrong character set.
Syntax
The syntax of the CONVERT function is:
CONVERT( <character_string> , <dest_char_set> , optional <source_char_set> )
Arguments
- The <
dest_char_set
> argument is the value to be converted. It can be any of the datatypesCHAR
,VARCHAR2
,NCHAR
,NVARCHAR2
,CLOB
, orNCLOB
. - The <
dest_char_set
> argument is the name of the character set to whichchar
is converted. - The <
source_char_set>
argument is the name of the character set in whichchar
is stored in the database. The default value is the database character set.
Note
Popular character sets include:
Character Set | Description |
---|---|
US7ASCII | US 7-bit ASCII character set |
WE8ISO8859P1 | ISO 8859-1 West European 8-bit character set |
EE8MSWIN1250 | Microsoft Windows East European Code Page 1250 |
WE8MSWIN1252 | Microsoft Windows West European Code Page 1252 |
WE8EBCDIC500 | IBM West European EBCDIC Code Page 500 |
UTF8 | Unicode 3.0 Universal character set CESU-8 encoding form |
AL32UTF8 | Unicode 5.0 Universal character set UTF-8 encoding form |
Example
This example converts an ISO 8859-1 West European 8-bit character set to a US 7-bit ASCII character set. SELECT CONVERT('Ä Ê Í Õ Ø A B C D E ', 'US7ASCII', 'WE8ISO8859P1') Results in: --------------------- A E I ? ? A B C D E ?
See Also:
Share the Knowledge