oracle 9i环境先建一张实验表
create table TEST_DATATYPE
(
COL_1 FLOAT,
COL_2 NUMBER(28,14)
);然后插入数据
insert into test_datatype (col_1,col_2)
select '38660596658.4746','38660596658.4746' from dual;看一下插进表中的数据
select * from test_datatype t;col_1 col_2
38660596658.4746 38660596658.47460480000000col_2的数值明显不正确实验继续
select t.col_1,t.col_2,to_number(t.col_2) as col_3 from test_datatype t;col_1 col_2 col_3
38660596658.4746 38660596658.47460480000000 38660596658.4746加上to_number之后竟然又正确了请问这到底是怎么回事儿?
create table TEST_DATATYPE
(
COL_1 FLOAT,
COL_2 NUMBER(28,14)
);然后插入数据
insert into test_datatype (col_1,col_2)
select '38660596658.4746','38660596658.4746' from dual;看一下插进表中的数据
select * from test_datatype t;col_1 col_2
38660596658.4746 38660596658.47460480000000col_2的数值明显不正确实验继续
select t.col_1,t.col_2,to_number(t.col_2) as col_3 from test_datatype t;col_1 col_2 col_3
38660596658.4746 38660596658.47460480000000 38660596658.4746加上to_number之后竟然又正确了请问这到底是怎么回事儿?
select '38660596658.4746','38660596658.4746' from dual;
可能是你做插入的时候是文本数据库做隐式转换造成的,
你直接插入数值,应该是没有问题的
insert into test_datatpye (col_1,col_2)
select 38660596658.4746,38660596658.4746 from dual;问题一样