Oracle String/Char Function - Oracle/PLSQL CONVERT Function






This Oracle tutorial explains how to use the Oracle/PLSQL CONVERT function.

CONVERT(x,to_char_set[,from_char_set]) converts x from from_char_set to to_char_set.

Syntax

The syntax of the CONVERT function is:

CONVERT( string1 , to_char_set , [ from_char_set ] )

string1 is the string to be converted.

to_char_set is the character set to convert to.

from_char_set is the character set to convert from.

We can use the following character sets:

Character Set Description
US7ASCII US 7-bit ASCII character set
WE8DEC West European 8-bit character set
WE8HP HP West European Laserjet 8-bit character set
F7DEC DEC French 7-bit character set
WE8EBCDIC500 IBM West European EBCDIC Code Page 500
WE8PC850 IBM PC Code Page 850
WE8ISO8859P1 ISO 8859-1 West European 8-bit character set




Example


SQL>-- w ww .jav  a2s. c om
SQL> select convert('A  ', 'US7ASCII') from dual;

CONV
----
A  Z

SQL> select convert('A  ', 'US7ASCII', 'WE8ISO8859P1') from dual;

CONV
----
A  ?

SQL>