decimal formatting in sql query

前提是你 提交于 2019-12-12 04:09:08

问题


I have a query as below:

Select price from myTable;

This returns value '22.50'

However, I need the format as 5.8 bytes in my program.

That is my String value should be '00022.50000000' and not '22.50'

Is there a way to achieve this directly in SQL ?


回答1:


From docs, I think you want CHAR( DECIMAL( 22.50, 13, 8 ) )

I have no DB2 instance to play with so can't verify. These functions are not ANSI SQL, they are DB2 specific.



来源:https://stackoverflow.com/questions/9696496/decimal-formatting-in-sql-query

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!