Pad Numbers with Zereos
Hi guys,
Here's my dilemma. I have a column in a table with TEST SCORE results. It's a raw score which i convert to a percentage. I am exporting a fixed lenght text document, and score needs to be of 6 spaces long. Here is the function i have to extract score
select UPPER(RPAD((SCORE/50)*100,6)) AS "SCORE" from test;
This works fine, but now i have been told i need to pad the number with zereos, so for example if the score is 96, the bosses would like to see it as 096.00, or 100 as 100.00, so then i wrote this:
select to_char((SCORE/50)*100, '000.00') from test;
The problem i am running across now is when i query the lenght of this column, for example,
select length(to_char((SCORE/50)*100, '000.00')) from test; I get that my SCORE is now being recognized as 7 characters instead of 6 which is not good... WHAT AM I DOING WRONG??? please help... Thanks in advance.