程序如下。
declare
-- Local variables here
i integer;
a number(19,7);
b number(19,3);
c number(19,7);
begin
-- Test statements here
a := 123456789012.1234567;
b := 1.000;
c := a * b;
dbms_output.put_line(c); -- 输出123456789012.1234567
dbms_output.put_line(a * b); -- 输出123456789012.1234567 INSERT INTO AAA
(AAA) VALUES(c);
COMMIT;
end;问题是插入表中的数据就是
123456789012.1230010。
表AAA的字段AAA的类型是NUMBER(19,7)的。为什么?哪位能给解释一下。
declare
-- Local variables here
i integer;
a number(19,7);
b number(19,3);
c number(19,7);
begin
-- Test statements here
a := 123456789012.1234567;
b := 1.000;
c := a * b;
dbms_output.put_line(c); -- 输出123456789012.1234567
dbms_output.put_line(a * b); -- 输出123456789012.1234567 INSERT INTO AAA
(AAA) VALUES(c);
COMMIT;
end;问题是插入表中的数据就是
123456789012.1230010。
表AAA的字段AAA的类型是NUMBER(19,7)的。为什么?哪位能给解释一下。
解决方案 »
- 使用Oracle数据库,做分页,需要对数据库做什么操作?
- ORACLE SQL 查询结果集怎么拼接??
- 新手提问,关于查询已经创建好的VIEW里面全部字段的问题。(多表的UNION起来的情况很棘手,请有经验的朋友来看一下)
- 用OCI编程的问题???
- PL/SQL如何輸出99乘法表
- 怎么样才能为新开发的程序建立独立的库,不影响旧程序的库
- 无法停止 Oracle 服务??
- 等待解决我给分呀着急!!!!
- 我的oracle8.1.6为什么启动不起来????各位大侠帮忙啊!!
- SQL中Group By的一些问题。
- oracle 9i备份出现的问题
- select 'A' + a.company_id as new_id from t_pub_user a
alter table aaa add (b,number,a number(19,7),b1 number(19,3))
declare
a number;
b number;
c number;
begin
a:=123456789012.7654321;
b:=1.000;
c:=a*b;
dbms_output.put_line(c);
dbms_output.put_line(a*b);insert into aaa values (c,b,a,b);
commit;
end;
在插入数据库是a的值改变了
即使用insert into aaa (a) values (123456789012.1234567)
插入到数据库的值还是123456789012.1230010
SQL> drop table aaa;Table droppedSQL> create table aaa(aa number(19,7));Table createdSQL> insert into aaa select 123456789012.7654321 from dual;1 row insertedSQL> commit;Commit completeSQL> select * from aaa; AA
---------------------
123456789012.7650080SQL> select to_char(aa) from aaa;TO_CHAR(AA)
----------------------------------------
123456789012.7654321
declare
a number(19,7);
b number(19,3);
c number(19,7);
begin a := 123456789012.1234567;
b := 1.000;
c := a * b; insert into t7 values(9,c,'T');
insert into t7 values(10,a*b,'T');end;
/
SQL> select * from t7; F1 F2 F3
-------------------- -------------------- ----------------------------------------
9 123456789012.1234567 T
10 123456789012.1234567 T
SQL> desc t7
名前 NULL? 型
----------------------------------------- -------- ----------------------------
F1 NOT NULL NUMBER(10)
F2 NUMBER(19,7)
F3 VARCHAR2(40)