在现有一个系统遇到百分比数值不对的bug
经测试发现时精度问题引起的
随测试数据如下:
create table test_report_table (amount number(5,2),age number(5));
insert into test_report_table values(5.333,5.333);
insert into test_report_table values(2/3,2/3);
select * from test_report_table;
AMOUNT AGE
5.33 5
0.67 1
说明数值类型在oracle中的影响
经测试发现时精度问题引起的
随测试数据如下:
create table test_report_table (amount number(5,2),age number(5));
insert into test_report_table values(5.333,5.333);
insert into test_report_table values(2/3,2/3);
select * from test_report_table;
AMOUNT AGE
5.33 5
0.67 1
说明数值类型在oracle中的影响
本文通过一个具体的Oracle数据库案例探讨了数值类型在Oracle中的表现及其带来的精度问题。通过创建表并插入特定数值,展示了实际存储和预期之间的差异,揭示了在处理浮点数时应注意的数据类型选择及可能遇到的问题。
1350

被折叠的 条评论
为什么被折叠?



