To expound upon Corion
's wisdom, you are conflating numerical values and formatting. As far as your database (as well as Perl) is concerned, 0301
are the same number, but are different strings. Oracle will also truncate trailing zeroes in decimals, because those contain no numerical information.
So the question is do you need to store all four digits, which would suggest you should use perhaps a char(4) type instead, or do you just need to output four digits? Any time you need to control formatting on a numerical output, you should probably turn to printf/sprintf, e.g.
~$ perl -e 'printf "%04d\n", 301'
#11929 First ask yourself `How would I do this without a computer?' Then have the computer do it the same way.