-->

Spiga

NUMBER TO WORD CONVERSATION

Number To Word Conversation Oracle Function.


Create or Replace Function NUM2WORD(no in number,Curr in varchar2,mincurr in varchar2,Ind in char)
return varchar2 is
word varchar2(30000);
no2 varchar2(10);
stg integer := 0;
Begin
no2 := to_char(trunc(no));
stg := 1;
Select decode(no2,0,'Zero',decode(sign(length(no2)-6),-1, Curr ||to_char(to_date(trunc(no),'J'),'Jsp'),
decode(sign(length(no2)-8),-1,
Curr ||to_char(to_date(substr(no2,-1*length(no2),length(no2)-5),'J'),'Jsp')||' Lakhs '
||decode(substr(no2,-5),0,null,to_char(to_date(substr(no2,-5),'J'),'Jsp')),
Curr ||to_char(to_date(substr(no2,-1*length(no2),length(no2)-7),'J'),'Jsp')||' Crores '
||decode(substr(no2,-7,2),0,null,to_char(to_date(substr(no2,-7,2),'J'),'Jsp')||' Lakhs ')
||decode(substr(no2,-5),0,null,to_char(to_date(substr(no2,-5),'J'),'Jsp'))) ))
||decode( mod(no,1), 0,null, decode(Ind,'Q', ' Point ', ' and ')
||mincurr||to_char(to_date(mod(no,1)* decode(Ind,'Q',1000,100),'J'),'Jsp')) ||' Only'
Into word From Dual;
stg := 2;
Return(REPLACE(word,'-',' '));
Exception
When others then
raise_application_error(-20189, 'Error ' || sqlerrm || ' inside Num2Char Conversion at stage ' || stg);
End;

There was an error in this gadget