This is not very regular but kind of very good trick. How to Convert number into strings. Here is a standard Oracle Package , generally used in AP side but can be use in your code also.
SELECT ap_amount_utilities_pkg.ap_convert_number(12345) AS amt_in_words FROM dual;
We used this in some localized reports and check printing.