trunc and round function in sql

谁都会走 提交于 2019-12-01 20:24:46

No, behavior depends on the value of the significant digit (the 3rd digit (the 3) is the significant one in your case, as it is below 5 round and trunc do the same )

try select trunc(125456.76,-4) from dual (result is 120000) vs select round(125456.76,-4) from dual (result is 130000). Now when the significant digit is 5 (or higher) the results of trunc and round differ.

ROUND is related to round figure of given value.

TRUNC is related to truncation of given values.

In round case of given example, four places till 4th place prior to decimal point padded with 0.

But in trunc case, four places till 4th place prior to decimal point replacd with 0.

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