Skip navigation
854 Views 1 Reply Latest reply: Feb 15, 2012 4:17 PM by Shawn Fox RSS
Rajesh New Enzee 1 posts since
Dec 21, 2009
Currently Being Moderated

Feb 15, 2012 4:09 PM

Formatting a $ value

Guys,

 

I was trying to format $ value  say 123456.78 using the following command.

SELECT TO_CHAR( 123456.78, '$999,999,999.99')

 

And I get the result as  ->    $   123,456.78

I was expecting a result like  $123,456.78

 

Is there a simple way to do that?  I appreciate your help.

 

Thanks.

Rajesh

  • Shawn Fox Enzee Exraordinaire 1,475 posts since
    Aug 15, 2006
    Currently Being Moderated
    1. Feb 15, 2012 4:17 PM (in response to Rajesh)
    Re: Formatting a $ value

    SELECT translate(TO_CHAR( 123456.78, '$999,999,999.99'), ' ', '');

     

    the only problem with using translate is that it is not going to result in a consistent width since it just cuts out the spaces... you could then use lpad on the result if you always want it to use a specific amount of space.

More Like This

  • Retrieving data ...

Bookmarked By (0)

Legend

  • Correct Answers - 4 points
  • Helpful Answers - 2 points