Link to home
Start Free TrialLog in
Avatar of Metalteck
MetalteckFlag for United States of America

asked on

Format Number Field

I have a field that is set up as a number 13,4.
I need to format it so that it looks like the following: 9999999V99.

I was trying to use the following formula, but its not working:
to_char(emp.pro_rate_total),999999999)

Any suggestions on how I can get this?
Avatar of awking00
awking00
Flag of United States of America image

Can you post some sample numbers from your number(13,4) field and what you would expect them to look like after you've formatted them?
Avatar of Metalteck

ASKER

Here are some example:
33009.6
0
91936
40996.8
85009.6
37999.52
27768
86008
56.16
40809.6
50003.2
119995.2
47840
98342.4
94536
60008
54038.4
29993.6
78000
73507.2
Avatar of Sean Stuber
Sean Stuber

to_char(emp.pro_rate_total,'fm9999999d99','NLS_NUMERIC_CHARACTERS = ''V ''')

you didn't specify a grouping character so I made it a space (' ')
The examples are fine, but how do you each of them to appear after formatting? sdstuber has shown you how to replace the decimal point with the "V" and round to two decimals and that might be all you need.
The expected result, regardless of the value is that each value needs to be 9 characters long without any leading 0s.
does that mean you want leading spaces or does that mean you want trailing zeros?

or does that mean something else?
if you supply only 56.16,  that's only 5 characters.

What and where do you want the other 4 characters to be?
Yes, I would need leading spaces since it needs to be right justified.
so you want trailing zeroes for values like these?  If so, do you want it to always be 2 digits after the decimal? If not, please be specific.

0
85009.6
86008

this really would be a faster process if you supplied both the input and the expected output
Yes, I would like for 2 digits after the decimal.
ASKER CERTIFIED SOLUTION
Avatar of Sean Stuber
Sean Stuber

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial