Home » SQL & PL/SQL » SQL & PL/SQL » Number conversion in oracle (Oracle 10g)
Number conversion in oracle [message #354835] Tue, 21 October 2008 09:00 Go to next message
trivendra
Messages: 208
Registered: October 2007
Location: Noida, India
Senior Member
Hi,

I am facing a problem in number conversion. My requirement is to make number 0 as 0.0000 as provided by precision and scale in user_tab_columns.

Following is the query i ran ..

SQL> SELECT TO_CHAR (0, '9.99999') FROM DUAL;

TO_CHAR(
--------
  .00000

SQL> 


But I need the output like

0.00000

Thanks
Trivendra
Re: Number conversion in oracle [message #354838 is a reply to message #354835] Tue, 21 October 2008 09:13 Go to previous messageGo to next message
joicejohn
Messages: 327
Registered: March 2008
Location: India
Senior Member
@trivendra,

This should work:

SQL> SELECT TO_CHAR (0, '0.99999') FROM DUAL;

TO_CHAR(
--------
 0.00000


Regards,
Jo
Re: Number conversion in oracle [message #354842 is a reply to message #354835] Tue, 21 October 2008 09:52 Go to previous messageGo to next message
Michel Cadot
Messages: 64103
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
A useful link you should read: Number Format Elements

Regards
Michel
Re: Number conversion in oracle [message #354878 is a reply to message #354838] Tue, 21 October 2008 14:53 Go to previous message
trivendra
Messages: 208
Registered: October 2007
Location: Noida, India
Senior Member
Thanks for wonderful help.
Previous Topic: Update statement
Next Topic: package athat automatically inserts error code n message
Goto Forum:
  


Current Time: Sat Dec 03 22:29:37 CST 2016

Total time taken to generate the page: 0.11305 seconds