DEVFYI - Developer Resource - FYI

Display the number value in Words?

ORACLE Interview Questions and Answers (Part 3)

(Continued from previous question...)

520. Display the number value in Words?

SQL> select sal, (to_char(to_date(sal,'j'), 'jsp'))
from emp;
the output like,
--------- ----------------------------------------
800 eight hundred
1600 one thousand six hundred
1250 one thousand two hundred fifty
If you want to add some text like, Rs. Three Thousand only.
SQL> select sal "Salary ",
(' Rs. '|| (to_char(to_date(sal,'j'), 'Jsp'))|| ' only.'))
"Sal in Words" from emp
Salary Sal in Words
------- -----------------------------------------------
800 Rs. Eight Hundred only.
1600 Rs. One Thousand Six Hundred only.
1250 Rs. One Thousand Two Hundred Fifty only.

(Continued on next question...)

Other Interview Questions