Conversion Functions
Conversion Functions
The Conversion functions convert data from one data type to another. In some cases oracle server
automatically converts the data to the required type. This is called implicit conversion. Explicit conversions
are done by using the conversion functions.
Oracle provides three functions to covert from one data type to another.
1. To_CHAR
2. TO_NUMBER
3. TO_DATE
The TO_CHAR function converts the number or date to VARCHAR2 data type in the specified format
(fmt). The nlsparams parameter is used for number conversions. The nlsparams specifies the following
number format elements:
Decimal character
Group separator
Local currency symbol
International currency symbol
If the parameters are omitted, then it uses the default formats specified in the session.
Converting Dates to Character Type Examples. The Date format models are:
9: Specifies numeric position. The number of 9's determine the display width.
0: Specifies leading zeros.
$: Floating dollar sign
.: Decimal position
,: Comma position in the number