Write a pl*sql block to accept a number from the user. With the help of pl*sql arrays, write a program for number to word conversion up to 99 crores. The program should cater to rs. And paise also. For example, if the user enters:- 123451250.75 the output of your program should be:- rs. Twelve crores, thirty four lakhs, fifty one thousand, two hundred and fifty and seventy five paise only.
Answers
I m really very sorry...I'm unable to understand ur question
Answer:
DECLARE
salary INTEGER;
num_to_word VARCHAR2(100);
str VARCHAR2(100);
len INTEGER;
c INTEGER;
BEGIN
--Accept Salary from prompt 'Enter Salary : ';
Salary := &Salary;
input(Salary,Salary);
len := Length(Salary);
dbms_output.Put_line('Entered Salary is: '||Salary );
FOR i IN 1.len LOOP
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;
num_to_word = num_to_word ||str;
END LOOP;
dbms_output.Put_line('Number to words: '||num_to_word);
END;
Explanation:
Above PL-SQL program will print output as per input value. This program will convert number into words.