当前位置: 移动技术网 > IT编程>数据库>Oracle > SQL中的函数——Round()函数

SQL中的函数——Round()函数

2020年04月22日  | 移动技术网IT编程  | 我要评论

中国梦想秀2013,冯巩小品下载,家具展

round(exp1,exp2)函数具有四舍五入的功能,分为以下两种情况:

1.exp2数为非负

四舍五入的位数从小数点后开始计数,小数点后|exp2|位,看後一位,进本位,后面舍去

select round(125.455,0) from dual   ---125
select round(125.455,1) from dual   ---125.5
select round(125.455,4) from dual   ---125.455  大于小数位数,其余的位数补0将不显示

2.exp2数为负

四舍五入的位数从小数点前开始计数,小数点前|exp2|位,看本位,进前一位,本位以及后面取0

select round(125.455,-1) from dual   ---130
select round(125.455,-2) from dual   ---100
select round(125.455,-3) from dual   ---0
select round(125.455,-4) from dual   ---0

如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复

相关文章:

验证码:
移动技术网