oracle使用to_char格式化之后的字符串有空格改如何处理?

在使用jmeter工具进行断言时发现数字一样却总是断言失败,多次观察之后,发现数据库计算出来的数值前有空格???!!!

以下是to_char格式化语句:

 select to_char(TOTALMARK/ALLPERSONS,'0.0'),ALLPERSONS,bookid from t_book_score_stat where TOTALMARK is not null and rownum<5

分明都是2.9,为啥就是断言失败。。。

|

|

|

而当我加上trim,空格就消失了,断言也就成功了。

select trim(to_char(TOTALMARK/ALLPERSONS,'0.0')),ALLPERSONS,bookid from t_book_score_stat where TOTALMARK is not null and rownum<5

 

深层含义可移步:https://www.cnblogs.com/kerrycode/p/5084411.html

 

posted @ 2020-03-26 19:49  where_fresh  阅读(667)  评论(0)    收藏  举报