char转换的数字不适用于领导0
我有一个将数字转换为字符的情况。
但是,当我尝试将它们转换为char时,丢失了0。 因此,我尝试使用以下方法进行转换。
从dual中选择rtrim(to_char(0.5,'fm90.099'),'。');
但这与00.500不起作用。 00.500也为0.50 110.50作为#######。要使此情况工作,我需要将其更改为to_char(110.50,'fm990.099)。但是,如果有4位数字,它将再次起作用。 我也不确定生产系统可以拥有多少位数字。 是否还有其他可以将数字转换为0的字符。
I have a case to convert the numbers to character.
But the 0 are missing when i try to convert them to char.
So i tried to convert with the following method.
select rtrim(to_char(0.5, 'FM90.099'), '.') from dual;
But this doesnt work with 00.500. 00.500 also comes as 0.50
and 110.50 comes as #######. to make this case work i need to change this as to_char(110.50,'FM990.099). but again it wont work if there is a 4 digit number.
I am also not sure how many digits can the production system have.
is there any other to convert number to char with which the 0's doesnt miss.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
放入足够的领先和尾随
9
s,以说明您的最高精度和比例。如果格式掩码不够大,请增加9
s的数量,直到为止。对于示例数据:
输出:
db&lt; Ferrer“>在这里 < /em>
Put in sufficient leading and trailing
9
s to account for your maximum precision and scale. If the format mask is not big enough then increase the number of9
s until it is.Which, for the sample data:
Outputs:
db<>fiddle here