欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

CAST() 函数

程序员文章站 2022-04-09 19:06:09
作用: 四舍五入 SELECT CAST('9.0' AS DECIMAL) FROM DUAL; -- 9 SELECT CAST('9.5' AS DECIMAL) FROM DUAL; -- 10 SELECT CAST('9.6' AS DECIMAL) FROM DUAL; -- 10 S ......

作用: 四舍五入
select cast('9.0' as decimal) from dual; -- 9

select cast('9.5' as decimal) from dual; -- 10

select cast('9.6' as decimal) from dual; -- 10

select cast('9.3' as decimal) from dual; -- 9

select cast('9.5' as decimal(10,3)) from dual; -- 9.500