PL/SQL Program to Accept Number and Print in Alphabet

PL/SQL Program to Accept Number and Print in Alphabet:



declare  
no number; 
no_to_word varchar2(100);
str varchar2(100);
len number;
c number; 

begin
no:=:no;
len:=Length(no);
dbms_output.put_line('Entered Number is: '||no);
for i in 1..len
loop
c:=substr(no,i,1);
select decode(c,0,'Zero ',1,'One ',2,'Two ',3,'Three ',4,'Four ',5,'Five ',6,'Six ',7,'Seven ',8,'Eight ',9,'Nine ')
into str from dual;
no_to_word:=no_to_word||str;
end loop;
dbms_output.put_line('Number to word: '||no_to_word);
end;

OUTPUT:

Entered Number is: 47856
Number to word: Four Seven Eight Five Six




Leave a Reply

Your email address will not be published. Required fields are marked *

six − four =