Oracle's in_char function lets you convert numbers into a text string, but it's an unusual facility to have as as built-in; there's no such facility (as far as I know) in MySQL but you can get around this easily enough within your controlling application - the Nums2Words module on the CPAN (in Perl), and a similar module on the PEAR (for PHP users) does all the hard work for you.
Here's a Perl example:
use Nums2Words;
@testvals = (7, 12, 153, -19, 1234007, 0.7,
3.1415, 666.62, -176.75, 10.6e15);
foreach $number(@testvals) {
$t1 = ucfirst(lc(num2word($number)));
print "$number = $t1\n";
}
When you run that, you get
earth-wind-and-fire:~/jun07 grahamellis$ perl n2w
7 = Seven
12 = Twelve
153 = One hundred fifty-three
-19 = Negative nineteen
1234007 = One million, two hundred thirty-four thousand, seven
0.7 = Zero and seven tenths
3.1415 = Three and one thousand, four hundred fifteen ten-thousandths
666.62 = Six hundred sixty-six and sixty-two hundredths
-176.75 = Negative one hundred seventy-six and seventy-five hundredths
1.06e+16 = One and six thousand, sixteen millionths
earth-wind-and-fire:~/jun07 grahamellis$
A web search lead me to similar code in Java, and no doubt there's someting in the Cheeseshop if you're a Python programmer.
Lesson to be learnt - look around before you re-write code! (written 2007-06-17)
Associated topics are indexed as below, or enter http://melksh.am/nnnn for individual articles
S157 - More MySQL commands [158] MySQL - LEFT JOIN and RIGHT JOIN, INNER JOIN and OUTER JOIN - (2004-12-20)
[159] MySQL - Optimising Selects - (2004-12-21)
[279] Getting a list of unique values from a MySQL column - (2005-04-14)
[449] Matching in MySQL - (2005-09-24)
[494] MySQL - a score of things to remember - (2005-11-12)
[502] SELECT in MySQL - choosing the rows you want - (2005-11-22)
[513] MySQL - JOIN or WHERE to link tables correctly? - (2005-12-01)
[515] MySQL - an FAQ - (2005-12-03)
[517] An occasional chance, and reducing data to manageable levels - (2005-12-04)
[567] Combining similar rows from a MySQL database select - (2006-01-17)
[572] Giving the researcher power over database analysis - (2006-01-22)
[581] Saving a MySQL query results to your local disc for Excel - (2006-01-29)
[591] Key facts - SQL and MySQL - (2006-02-04)
[673] Helicopter views and tartans - (2006-04-06)
[1213] MySQL - the order of clauses and the order of actions - (2007-06-01)
[1331] MySQL joins revisited - (2007-09-03)
[1574] Joining MySQL tables revisited - finding nonmatching records, etc - (2008-03-15)
[1735] Finding words and work boundaries (MySQL, Perl, PHP) - (2008-08-03)
[1904] Ruby, Perl, Linux, MySQL - some training notes - (2008-11-23)
[2110] MySQL - looking for records in one table that do NOT correspond to records in another table - (2009-03-31)
[2259] Grouping rows for a summary report - MySQL and PHP - (2009-06-27)
[2448] MySQL - efficiency and other topics - (2009-10-10)
[2643] Relating tables with joins in MySQL - (2010-02-21)
[2644] Counting rows in joined MySQL tables - (2010-02-22)
[2645] Optimising and caching your MySQL enquiries - (2010-02-22)
[2647] Removing duplicates from a MySQL table - (2010-02-22)
[3061] Databases - why data is split into separate tables, and how to join them - (2010-11-20)
[3270] SQL - Data v Metadata, and the various stages of data selection - (2011-04-29)
[4481] Extracting data from backups to restore selected rows from MySQL tables - (2015-05-01)
P219 - Perl - Libraries and Resources [86] Talk review - Idiomatic Perl, David Cross - (2004-10-12)
[112] Avoid the wheel being re-invented by using Perl modules - (2004-11-08)
[357] Where do Perl modules load from - (2005-06-24)
[358] Use standard Perl modules - (2005-06-25)
[712] Why reinvent the wheel - (2006-05-06)
[737] Coloured text in a terminal from Perl - (2006-05-29)
[760] Self help in Perl - (2006-06-14)
[1219] Judging the quality of contributed Perl code - (2007-06-06)
[1391] Ordnance Survey Grid Reference to Latitude / Longitude - (2007-10-14)
[1444] Using English can slow you right down! - (2007-11-25)
[1863] About dieing and exiting in Perl - (2008-11-01)
[1865] Debugging and Data::Dumper in Perl - (2008-11-02)
[2229] Do not re-invent the wheel - use a Perl module - (2009-06-11)
[2234] Loading external code into Perl from a nonstandard directory - (2009-06-12)
[2427] Operator overloading - redefining addition and other Perl tricks - (2009-09-27)
[2931] Syncronise - software, trains, and buses. Please! - (2010-08-22)
[3009] Expect in Perl - a short explanation and a practical example - (2010-10-22)
[3101] The week before Christmas - (2010-12-23)
[3377] What do I mean when I add things in Perl? - (2011-08-02)
Some other Articles
End of File on a Java BufferedReaderThe kind spirit of MelkshamWhat proportion of our web traffic is robots?Trying things in PythonOutputting numbers as words - MySQL with Perl or PHPA review of a week and a trip to BruggeHorses of BruggeBathtub exampleSur le ContinentCommenting a Perl Regular Expression