why am I getting ###############?
Because you’ve asked oracle to format a 12 digit number but allowed it only 9 digits to do it with:
Either make the number 3 digits shorter, or make the format string 3 digits longer
SELECT TO_CHAR (300000000, '999G999G999D99') FROM DUAL;
SELECT TO_CHAR (300000000000, '999G999G999G999D99') FROM DUAL;
solved To SELECT TO_CHAR (300000000000, ‘999G999G999D99’) FROM DUAL;