U of A University of Arkansas Division of Agriculture

Pictures of chickens, flowers, wheat, a boy looking through a magnifying glass, irrigation pipe, soybean pods, and fruits and vegetables.

Cooperative Extension Service

Cooperative Extension Service

Agricultural Experiment Station

Steve Rea's
Oracle Tips, Tricks, and Scripts

Link to Steve Rea's Oracle Certification graphic


Search | Publications | Jobs | Personnel Directory | Links

Alphabetic Dollar Amounts for Check Applications

Here's a trick from Jayne Albino on how to turn a numeric value, such as 54334, into an alphabetic value, such as FIFTY-FOUR THOUSAND THREE HUNDRED THIRTY-FOUR.  To do this, use the SP date format to spell out the number after converting the number to a date (using julian conversion):

select to_char(to_date(54334,'J'),'JSP') from dual;  -- For upper-case letters
select to_char(to_date(54334,'J'),'JsP') from dual;  -- For mixed-case letters
select to_char(to_date(54334,'J'),'jSP') from dual;  -- For lower-case letters

The minimum julian number allowed is 1, and, the maximum julian number allowed is 5373484, so, if you want to make a check out for a larger amount, just send it to me!  Also, this only works for integer amounts.  If you want dollars and cents, you'll have to split up the amount into it's integer and decimal parts, and handle the case of a zero amount, such as in:

select decode(trunc(54334.69),0,'ZERO',to_char(to_date(trunc(54334.69),'J'),'JSP'))
     || ' DOLLARS AND ' || decode(trunc(mod(54334.69,1)*100),0,'ZERO',
     to_char(to_date(trunc(mod(54334.69,1)*100),'J'),'JSP')) || ' CENTS'
     from dual;

Or, to make it general, using a variable amount (you'll have to do an "undefine amount" afterwards if you want to try out other values):

select decode(trunc(&&amount),0,'ZERO',to_char(to_date(trunc(&&amount),'J'),'JSP'))
     || ' DOLLARS AND ' || decode(trunc(mod(&&amount,1)*100),0,'ZERO',
     to_char(to_date(trunc(mod(&&amount,1)*100),'J'),'JSP')) || ' CENTS'
     from dual;

This Page was Last Updated on 06/04/07

You Are Visitor Number

Hit Counter

Link to CES Home PageBack To CES Home Page

Link to Steve Rea's Oracle PageBack To Steve Rea's Oracle Page

Back to top of this pageBack To Top


© 2006
University of Arkansas
Division of Agriculture
All rights reserved.
Last Date Modified 02/09/2008
Webmaster

University of Arkansas • Division of Agriculture
Cooperative Extension Service
2301 South University Avenue
Little Rock, Arkansas 72204 • USA
Phone (501) 671-2000 • Fax (501) 671-2209
 

MissionDisclaimerEEO
PrivacyFOI