Monday, March 21, 2011

SQL Query to Display Numbers in Figures

Example 1:-

SELECT TO_CHAR(TO_TIMESTAMP(LPAD(12345678, 9, '0'), 'FF9'),'FFSP') AS Value_in_words  FROM DUAL -- For Upper Case Letters

SELECT TO_CHAR(TO_TIMESTAMP(LPAD(12345678, 9, '0'), 'FF9'),'Ffsp') AS Value_in_words  FROM DUAL -- For Mixed Case Letters

SELECT TO_CHAR(TO_TIMESTAMP(LPAD(12345678, 9, '0'), 'FF9'),'ffsp') AS Value_in_words  FROM DUAL -- For Lower Case Letters

Example 2:-

select to_char(to_date(1122187,'J'),'JSP') Value_in_words from dual   -- For upper-case letters

select to_char(to_date(1122187,'J'),'Jsp') Value_in_words from dual  -- For mixed-case letters

select to_char(to_date(1122187,'J'),'jsp') Value_in_words from dual  -- For lower-case letters

No comments:

Post a Comment