如何从PostgreSQL中现有的int类型中获取一个具有char数据类型的新列



我在Postgres中有一列X,值为123。。。

如何获取一个新列,将这些值转换为onetwothree。。。

以下是我在互联网上找到的一些例子

你可以试试Money to word函数这是一个返回货币的函数,但没有小数适用于整个数字

您可以使用货币类型功能:

SELECT replace(cash_words('123'),'dollars and zero cents','');

返回

"One hundred twenty three "

https://www.postgresql.org/message-id/5192C4DF.7080601%40gmail.com

其他我没有尝试过的选项:

https://wiki.postgresql.org/wiki/Integer_to_Text

https://wiki.postgresql.org/wiki/Numeric_to_English

最新更新