I saw something where numbers were run through a julian date
function to derive their textual equivilant.
Took a minute, but found it on Peter Koletzke's Oracle Home Page
http://ourworld.compuserve.com/homepages/Peter_Koletzke/des2ktip.htm
Look at CONVERT NUMBERS TO WORDS
Later.. Rich
Disclaim: this is not my company's stuff.
In article <7k36da$glv$1...@naxos.belnet.be>,
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
============= Cut Here ===============
Function Spell (v_number in number) return varchar2 is
v_word varchar2(1000);
begin
select to_char(to_date(v_number,'j'), 'Jsp')
into v_word
from dual;
return v_word;
end;
============= END ===============
Mark
Guy Hendrickx wrote in message <7k36da$glv$1...@naxos.belnet.be>...
>Hi,
>I'm looking for a pl/sql procedure which is capable of translating
>a numeric value to a full-text string :
>ex. '20' will become 'twenty'.
>If possible it should be available for Ducth, French and English.
>If only one of the above languages is supported, I'm still interested.
>Kind regards,
>Guy Hendrickx
>G...@Cereus.BE
>
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')
--------------------------------------------------------------------------
Five Million Three Hundred Seventy-Three Thousand Four Hundred Eighty-Four
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
/
should be international already (language support)
See http://www.oracle.com/ideveloper/ for my column 'Digging-in to Oracle8i'...
Mirrored (and more current) at http://govt.us.oracle.com/~tkyte/
Current article is "Fine Grained Access Control", added June 8'th
Thomas Kyte tk...@us.oracle.com
Oracle Service Industries Reston, VA USA
--
Opinions are mine and do not necessarily reflect those of Oracle Corporation
Here's an example of printing dollars and cents in English words.
Hope this helps.
/*
Oracle SQL example of converting numbers to words. Given a
table called "CHK" with a single column "NUM" - number(7,2):
NUM
_______
.34
1234.45
3445
ZERO DOLLARS AND THIRTY-FOUR CENTS
ONE THOUSAND TWO HUNDRED THIRTY-FOUR DOLLARS AND FORTY-FIVE CENTS
THREE THOUSAND FOUR HUNDRED FORTY-FIVE DOLLARS AND ZERO CENTS
*/
select decode(instr(num,'.'),
1,'ZERO',
to_char(to_date(substr(num,1,decode(instr(num,'.'),
0,length(num),
instr(num,'.')-1)),
'J'),
'JSP'))
||' DOLLARS AND '||
decode(length(num)-instr(num,'.'),
1,to_char(to_date(rpad(substr(num,instr(num,'.')+1,
length(num)),
2,0),
'J'),
'JSP'),
decode(instr(num,'.'),
0,'ZERO',
to_char(to_date(substr(num,instr(num,'.')+1,length(num)),
'J'),
'JSP')))
||' CENTS '
from chk;
--
Kelly Young
Maricopa Community Colleges
yo...@maricopa.edu
select to_char( to_date(5373484,'J'),'Jsp','nls_date_language=french') from
dual
did for the Jsp format what it does for all the other
character type formats you would be done.
select to_char( to_date(5373484,'J'),'Day','nls_date_language=french') from
dual;
TO_CHAR(
--------
Vendredi
--
Jonathan Lewis
Yet another Oracle-related web site: www.jlcomp.demon.co.uk
Thomas Kyte wrote in message <376e20e8...@newshost.us.oracle.com>...
>See http://www.oracle.com/ideveloper/ for my column 'Digging-in to
Oracle8i'...
>Mirrored (and more current) at http://govt.us.oracle.com/~tkyte/
>
>Current article is "Fine Grained Access Control", added June 8'th
>
>Thomas Kyte tk...@us.oracle.com
>Oracle Service Industries Reston, VA USA
>--
>Opinions are mine and do not necessarily reflect those of Oracle
Corporation
Hi Guy,
I'm sorry I have to disappoint you.
Unfortunately the format mask 'JSP' is not influenced by the
nls_date_language. It always returns in English.
However you can use the nls_date_language in combination with other date
format masks.
Good luck,
Jan-Marcel
-- Alton
poor developer in Belgium.
When i try to add the 'NLS_DATE_LANGUAGE=Dutch' to the to_char function I
still get my results
in english. According to Oracle Support, only the english language is
supported.
Still, it's a pretty good thing to know.
Greatings
Gert
Peter L <ne...@lenniep.freeserve.co.uk> wrote in article
<7kbd1h$hlf$2...@news5.svr.pol.co.uk>...