列类型指定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>
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>
「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。




