Friday, 20 May 2011

Query for Numbers to Words

select to_char( to_date(5373484,'J'),'Jsp') from dual; 


select
TO_CHAR(TO_DATE(substr(1234567.123,1,instr(1234567.123,'.')-1),'J'),'JSP')||' and paise '||
replace(replace(replace(replace(TO_CHAR(TO_DATE(substr(1234567.123,instr(1234567.123,'.')+1,length(1234567.123)),'J'),'JSP'),'MILLION',''),'HUNDRED',''),'THOUSAND',''),'-',' ') as number_char
from dual.

j = julian. take the number and pretend it is a julian date, convert
it into a date.
jsp = Now, take that date and spell the julian number it represents

No comments:

Post a Comment