| Author's name: Connor McDonald
Author's Email: connor_mcdonald@yahoo.com |
Date written: August 22, 2001 Oracle version(s): 7.3+ |
| I am using to_char(num_col,'9999') to get a 4-character output, but is keeps coming out one column too wide. What's wrong ? | |
By default, Oracle reserves a space for a sign digit when converting a number to a character
SQL> select to_char(1234,'9999') x from dual; X ----- 1234 ^- note leading space
To remove this, all you need do is specify the additional FM mask ("fill mode")
SQL> select to_char(1234,'fm9999') x from dual; X ----- 1234
Further reading: N/A