Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: FUNCTION in PL/SQL
On Mon, 16 Jun 1997 11:30:57 +0100, "Acácio Nuno Loureiro de Jesus" <i19007_at_caravela.di.fc.ul.pt> wrote:
>Hi!
> If you have a function in PL/SQL that converts a number into it's
>designation like
>for example : 1 returns 'one'
> 10 returns 'ten'
> 234 returns 'two hundred and thirty four'
>Please send me.
> Thanks!
>
>Acácio.
>
You can use a date function to do this....
1* select to_char( to_date(5373484,'J'),'Jsp') from dual SQL> / TO_CHAR(TO_DATE(5373484,'J'),'JSP')
This will work for numbers between 1 and 5,373,484...
You can take it a step further to support numbers -5,373,484 .. 5,373,484 by
select decode( sign( :N ), -1, 'Negative ', 0, 'Zero', NULL ) ||
decode( sign( abs(:N) ), +1, to_char( to_date( abs(:N),'J'),'Jsp') )
from dual
/
Thomas Kyte
tkyte_at_us.oracle.com
Oracle Government
Bethesda MD
http://govt.us.oracle.com/ -- downloadable utilities
![]() |
![]() |