Srikanth Technologies

Converting Number to Words

I am providing a simple query in Oracle that returns words for the given number.


SQL> select  to_char( to_date(12345,'J'), 'JSP') from dual;

TO_CHAR(TO_DATE(12345,'J'),'JSP')
----------------------------------------
TWELVE THOUSAND THREE HUNDRED FORTY-FIVE

In the above query we first convert Number to Date using format J, which stands for Julian day. We use format JSP with TO_CHAR() to convert the given date to julian day and spell it as well.