PL/SQL To_Char

Oracle PL/SQL To_Char Function

The To_Char function converts a number or date to a string.

The To_Char Function syntax:

to_char( value, [ format_mask ], [ nls_language ] )

Example

select to_char(2199.85, '9999.9') from dual; 
2199.9

select to_char(2199.85, '9999.99') from dual;
2199.85

select to_char(2199.85, '$9,999.00') from dual;
$2,199.85

select to_char(86, '000099') from dual;
000086
select to_char(sysdate, 'yyyy/mm/dd') from dual; 
2008/10/11

select to_char(sysdate, 'Month DD, YYYY') from dual;
August 07, 2008

select to_char(sysdate, 'FMMonth DD, YYYY') from dual;
August 7, 2008

select to_char(sysdate, 'MON DDth, YYYY') from dual;
AUG 17TH, 2008

select to_char(sysdate, 'FMMon ddth, YYYY') from dual;
Oct 11th, 2008