See http://www.orafaq.com/wiki/Binary For `dec2bin` should also include option to add spacing. Can also look at passing in base as an option to expand logic to hex etc.