SQL*Plus: Release 10.2.0.1.0 - Production on 星期四 11月 13 09:13:09 2014Copyright (c) 1982, 2005, Oracle. All rights reserved.SQL> conn scott/tiger 已连接。 SQL> desc t 名称 是否为空? 类型 ----------------------------------------- -------- ---------------------- ID NUMBERSQL> drop table t purge;表已删除。SQL> create table t(id int);表已创建。SQL> desc t 名称 是否为空? 类型 ----------------------------------------- -------- ---------------------- ID NUMBER(38)
所以最大值是 2^15-1=32767,永远也不会到达8000000这个数的
类型改为number试试
INT
A whole number in the range of (-2**31) to (2**31)-1.
刚去查了了一下文档,integer相当于number(38),但是一般不建议使用此种类型,很少会用到这么大的数
不过无法退出的原因肯定是由于不能满足条件i=8000000造成的,啥原因没想通,有些猜想不好说,一会去测试下先
已写入 file afiedt.buf 1 declare
2 i integer; --定义变量
3 begin
4 i :=8000000-10;
5 loop
6 /* 插入数据 */
7 dbms_output.put_line(i);
8 /* 参数递增 */
9 i := i + 1;
10 /* 停止条件 */
11 if mod(i, 10000) = 0
12 then
13 dbms_output.put_line('commit');
14 end if;
15 exit when i=8000000;
16 end loop;
17 commit;
18* end;
SQL> /
7999990
7999991
7999992
7999993
7999994
7999995
7999996
7999997
7999998
7999999
commitPL/SQL 过程已成功完成。SQL>
测试了下没有你说的现象啊
已连接。
SQL> desc t
名称 是否为空? 类型
----------------------------------------- -------- ----------------------
ID NUMBERSQL> drop table t purge;表已删除。SQL> create table t(id int);表已创建。SQL> desc t
名称 是否为空? 类型
----------------------------------------- -------- ----------------------
ID NUMBER(38)