NUMBER TO WORDS CONVERSION
429406Nov 3 2004 — edited Oct 24 2006Hi All
I Have written a conversion function which accepts number as in parameter and returns varchar as out put.here i used'JSP'-julian spell check.
SQL> CREATE OR REPLACE FUNCTION CONVERSION(X IN NUMBER) RETURN VARCHAR2
2 IS
3 Y VARCHAR2(20);
4 BEGIN
5 Y:=TO_CHAR(TO_DATE(X,'J'),'JSP');
6 RETURN Y;
7 END;
8 /
Function created.
SQL> SELECT CONVERSION(50) FROM DUAL;
CONVERSION(50)
---------------------------------
FIFTY
this works fine, but when i have checked it for 10050.72
it is returning below exception.here i want to display as
ten thousand fifty and seventy two.
How to handle this.Any suggestions...
SQL> SELECT CONVERSION(10050.72)FROM DUAL;
SELECT CONVERSION(10050.72)FROM DUAL
*
ERROR at line 1:
ORA-01830: date format picture ends before converting entire input string
ORA-06512: at "SYS.STANDARD", line 231
ORA-06512: at "SCOTT.CONVERSION", line 5
Thanks In Advance
Sasidhar.P
SQL>