The reasons and solutions for the database number type 0.1 being retrieved as .1

The data displayed on the page is as follows:

I checked the database data


When Oracle converts the value 0.n to char type, it will automatically ignore the preceding 0.

 

Solution:
When using to_char, you need to format the number

select to_char(sum(work_hour),'fm9990.9')as workHour ,ID from EQUIPMENT b group by ID

 9 means: if there is a number, it will display a number, if it does not exist, it will display a space

 0 means: if there is a number, it will display the number, if it does not exist, it will display 0, which is a placeholder.

 FM stands for: delete the space if it is caused by 9

Guess you like

Origin blog.csdn.net/weixin_55823910/article/details/124927118