Home » SQL & PL/SQL » SQL & PL/SQL » number format
number format [message #255930] Thu, 02 August 2007 07:41 Go to next message
bbvic
Messages: 24
Registered: October 2006
Junior Member
select total_price from acct1 where id='1';

total_price
--------------
15.3

if i want to see like 15.30, how can i do?
Re: number format [message #255933 is a reply to message #255930] Thu, 02 August 2007 07:47 Go to previous messageGo to next message
joy_division
Messages: 4640
Registered: February 2005
Location: East Coast USA
Senior Member
col total_price format 99.00

is one way to do it in SQL*Plus only
Re: number format [message #255938 is a reply to message #255930] Thu, 02 August 2007 08:06 Go to previous messageGo to next message
Michel Cadot
Messages: 64103
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Have a look at TO_CHAR function.

Regards
Michel
Re: number format [message #255951 is a reply to message #255938] Thu, 02 August 2007 09:23 Go to previous messageGo to next message
bbvic
Messages: 24
Registered: October 2006
Junior Member
like this?
TO_CHAR(total_price, '999G999GD99')

[Updated on: Thu, 02 August 2007 09:23]

Report message to a moderator

Re: number format [message #255993 is a reply to message #255951] Thu, 02 August 2007 12:50 Go to previous messageGo to next message
Michel Cadot
Messages: 64103
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
bbvic wrote on Thu, 02 August 2007 16:23
like this?
TO_CHAR(total_price, '999G999GD99')

I don't think so.
What happened when you tried it?

Regards
Michel
Re: number format [message #256015 is a reply to message #255930] Thu, 02 August 2007 14:23 Go to previous message
Bill B
Messages: 1482
Registered: December 2004
Senior Member
Close, a G indicates a universal separator and a D is where the decimal indicator goes, so you might want to try.


select TO_CHAR(99.0, '999G999D99') from dual;

to_char(99.
-----------
99.00
Previous Topic: Selecting Second Option
Next Topic: View: duplicate record
Goto Forum:
  


Current Time: Sun Dec 04 14:58:19 CST 2016

Total time taken to generate the page: 0.09205 seconds