Reputation: 23
I am attempting to convert a large dollar amount into words via oracle SQL for each individual digit. For example: $555,555,555.55 = "dollar five five five comma five five five comma five five five period five five".
I tried the Julian Date version of converting numbers to words but it only goes up to the ten-thousand place, no larger.
Please help.
Upvotes: 0
Views: 1113
Reputation: 23
Results Image Okay I may have my syntax wrong but it forced an odd column in my results here is my code:
SELECT SUM (amount) AS amount,
REPLACE (
REPLACE (
REPLACE (
REPLACE (
REPLACE (
REPLACE (
REPLACE (
REPLACE (
REPLACE (
REPLACE (
REPLACE (
REPLACE (SUM (amount),
'$',
'dollar '),
',',
'comma '),
'.',
'period '),
'0',
'zero '),
'1',
'one '),
'2',
'two '),
'3',
'three '),
'4',
'four '),
'5',
'five '),
'6',
'six '),
'7',
'seven '),
'8',
'eight '),
'9',
'nine '
Upvotes: 1
Reputation: 1270573
You can use nested replace:
select replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(col, '$', 'dollar '
), ',', 'comma '
), '0', 'zero '
. . .
Upvotes: 1