标签: sql oracle
我正在搜索从查询中的数字中删除零的方法。它刚刚发生在我身上。 我得到的只是Trim查询的数字或Substring函数。
Trim
Substring
因此,如果我的输入为60400,那么我的输出应为64。 我不知道它是否可能。 如果有可能,那么我可能没有正确搜索。
60400
64
我做了什么:
select amount, to_char(trim(0 from amount)) as new_amount from my_deductions;
但这只会从数字中删除前导零。
答案 0 :(得分:2)
您可以使用Replace方法。以下是MySql和Oracle
Replace
select amount, replace(amount, '0', '') as new_amount from my_deductions;