Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Leading 0 for float numbers between 0 and 1
<falbrech_www_at_gmx.de> wrote in message
news:1140704714.322442.267100_at_v46g2000cwv.googlegroups.com...
> Hello Mark,
>
> well, I am developing with PHP. Right now I am using sprintf to display
> data correctly. Unfortunatley sprintf adds some 0s on the right sied so
> that .17 is displayed as 0.17000 (or whatever is given as argument).
> But only the 0 left to the decimal point should be added, the decimals
> should be taken as is. I was hoping that there is a way to solve the
> problem with the database.
> As I am developing with PHP I do not have problems with changing the
> datatype. So what will the to_char method look like? I do not
> understand the reference.
>
> thanks,
> Florian
>
numbers don't have a leading 0, string (characters) representing numbers
are used to display numbers can be formatted to have a leading 0. The
difference is that numbers have certain properties (like you can do
mathematical operations on them). Strings can't have mathematical
operations on them. (not unless you explicitly or implicitly convert the
character string to a number, but then it is a number.)
If you want to find out about formatting a number to a string you can go to otn.oracle.com and look at the documentation. Look at the SQL reference guide. In the table of contents look up format models .(function to_char) Jim Received on Thu Feb 23 2006 - 08:48:28 CST