[英]How to strip of the trailing decimal point only if it has no values after the point
I need to strip of the decimal point only if it has no value after the point eg. 我需要剥离小数点,只要它在点之后没有值,例如。
I100.
to I100
, strip. 去
I100
,脱衣舞。 but I100.1
to I100.1
no strip. 但是
I100.1
到I100.1
没有条带。
I tried with 我试过了
SELECT rtrim(to_char(100.100, 'FM999999999999999990'), '.') FROM dual
But this doesn't work as expected. 但这并不像预期的那样有效。
if the value is a string, you do not have to convert it to string once more. 如果值是字符串,则不必再将其转换为字符串。 Just use the function
rtrim
只需使用函数
rtrim
SELECT rtrim('100.100', '.') FROM dual;
\n|| RTRIM('100.100','.') |
RTRIM('100.100','。')|\n|
| :------------------- |
:------------------- |\n|
| 100.100 |
100.100 |\n
SELECT rtrim('100.', '.') FROM dual
\n|| RTRIM('100.','.') |
RTRIM('100。','。')|\n|
| :---------------- |
:---------------- |\n|
| 100 |
100 |\n
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.