I am using cash_words('100'); It is showing one hundred dollars and zero cents but i want one hundred rupees as output using cash_words only For that i used lc_monetary ='en_IN.UTF-8' but no use any other parameters need to change
Asked
Active
Viewed 476 times
0
-
1Welcome to StackOverflow! Can you provide a [minimal reproducible example](https://stackoverflow.com/help/minimal-reproducible-example) of your data?. E.g. in form of [db-fiddle](https://www.db-fiddle.com). – Alex Yu Sep 16 '21 at 05:08
-
in dbfiddle it is showing error error: function cash_words(numeric) does not exist – Anvesh Sep 16 '21 at 06:03
-
Try looking here? https://stackoverflow.com/questions/32089454/i-want-a-postgresql-function-to-get-amount-in-words-with-fils – richyen Sep 16 '21 at 06:21
-
ok, i am currently using above one but can i get using cash_words() in indian format – Anvesh Sep 16 '21 at 08:04
1 Answers
1
Can use the below script:
SELECT replace(cash_words('100'), 'dollars and zero cents', 'rupees');
This will give the following output:
One hundred rupees
Basically, we replace the dollars and zero cents text that is appended by the cash_words function with custom text. It can also be set to blank i.e '' if you do not want anything to be appended after the converted words.

Java enthusiast
- 11
- 3