首页 » ORACLE 9i-23c » 列类型指定int 与number有什么区别

列类型指定int 与number有什么区别

列类型指定int 与number有什么区别

int和number都是数值类型,int是正整数,number可以允许小数位,number重点在这里不多讲,只是说在不指定参数的情况下有什么区别?

还是老风格,用实例说话

SQL> conn zhang/zhang;
Connected.
SQL> create table tt(id int,id1 number);

Table created.

SQL> desc tt;
Name                                      Null?    Type
—————————————– ——– —————————-
ID                                                 NUMBER(38)
ID1                                                NUMBER

SQL> alter table tt add id1 number(38);
alter table tt add id1 number(38)
*
ERROR at line 1:
ORA-01430: column being added already exists in table

SQL> alter table tt add id2 number(38);

Table altered.

SQL> desc tt;
Name                                      Null?    Type
—————————————– ——– —————————-
ID                                                 NUMBER(38)
ID1                                                NUMBER
ID2                                                NUMBER(38)

SQL> insert into tt values(1.1,1.1,1.1);

1 row created.

SQL> select * from tt;

ID        ID1        ID2
———- ———- ———-
1        1.1          1

SQL>

打赏

目前这篇文章有2条评论(Rss)评论关闭。

  1. Shannon Losardo | #1
    2011-12-21 at 07:42

    Wonderful job right here. I really enjoyed what you had to say. Keep heading because you unquestionably bring a new voice to this topic. Not many people would say what youve said and still make it interesting. Properly, at least Im interested. Cant wait to see a lot more of this from you.

  2. Emily | #2
    2011-06-23 at 09:35

    What an awesome way to explain this—now I know everytihng!