Tuesday, February 19, 2013

Spell out numbers to words

rem -----------------------------------------------------------------------
rem Filename:   spellout.sql
rem Purpose:    This script will spell out numbers to words (handy for 
rem  cheque printing). Example '10' --> Ten
rem Date:       12-Sep-2000
rem Author:     Anonymous
rem -----------------------------------------------------------------------

select decode( sign( &num ), -1, 'Negative ', 0, 'Zero', NULL ) ||
       decode( sign( abs(&num) ), +1, to_char( to_date( abs(&num),'J'),'Jsp') )
from dual
/

No comments:

Post a Comment