Home Oracle Commands Oracle Syntax

TO_CHAR

Convert an expression to a character String

to_char(expression [,'format'] [,nls_format])

You can convert a DATE, NUMBER or expression into a character string.

The format may be either a CHAR format or a NUMBER format , This is used to convert expression to a string.

If no format is specified Oracle will use the default date format.
nls_format allows international formats to be applied.

Examples

to_char(1.234, '9999.9')      will return      '1.2'
to_char(1000.25, '9,999.99')  will return  '1,000.25'
to_char(1000.25, '$9,999.00') will return '$1,000.25'
to_char(25, '000099')         will return '000025'
to_char(-50, 'PR999')         will return '<50>'
to_char(17, 'RN99')           will return 'XVII'
to_char(timestamp, 'DD-MM-YYYY HH24:MI') will return 31-12-2005 23.30



Back to the Top

Simon Sheppard
SS64.com

additional query terms:
tochar