少年阿宾

那些青春的岁月

  BlogJava :: 首页 :: 联系 :: 聚合  :: 管理
  500 Posts :: 0 Stories :: 135 Comments :: 0 Trackbacks
SQL> create table lee(id number,name varchar2(100),score number,constraint pk_lee primary key(id));
 
Table created

 SQL> desc lee
Name  Type          Nullable Default Comments
----- ------------- -------- ------- --------
ID    NUMBER                                 
NAME  VARCHAR2(100) Y                        
SCORE NUMBER        Y                        
 
SQL> alter table lee add createtime date;
 
Table altered
 
SQL> desc lee
Name       Type          Nullable Default Comments
---------- ------------- -------- ------- --------
ID         NUMBER                                 
NAME       VARCHAR2(100) Y                        
SCORE      NUMBER        Y                        
CREATETIME DATE          Y                        
 
SQL> alter table lee modify createtime nvarchar2(100);
 
Table altered
 
SQL> desc lee
Name       Type           Nullable Default Comments
---------- -------------- -------- ------- --------
ID         NUMBER                                  
NAME       VARCHAR2(100)  Y                        
SCORE      NUMBER         Y                        
CREATETIME NVARCHAR2(100) Y                        
 
SQL> alter table lee rename column createtime to mytime;
 
Table altered
 
SQL> desc lee
Name   Type           Nullable Default Comments
------ -------------- -------- ------- --------
ID     NUMBER                                  
NAME   VARCHAR2(100)  Y                        
SCORE  NUMBER         Y                        
MYTIME NVARCHAR2(100) Y                        
 
SQL> alter table lee modify mytime date;
 
Table altered
 
SQL> desc lee
Name   Type          Nullable Default Comments
------ ------------- -------- ------- --------
ID     NUMBER                                 
NAME   VARCHAR2(100) Y                        
SCORE  NUMBER        Y                        
MYTIME DATE          Y                        
 
SQL> desc lee
Name   Type          Nullable Default Comments
------ ------------- -------- ------- --------
ID     NUMBER                                 
NAME   VARCHAR2(100) Y                        
SCORE  NUMBER        Y                        
MYTIME DATE          Y                         
                  
 
SQL> alter table lee rename column mytime to createtime;
 
Table altered
 
SQL> desc lee
Name       Type          Nullable Default Comments
---------- ------------- -------- ------- --------
ID         NUMBER                                 
NAME       VARCHAR2(100) Y                        
SCORE      NUMBER        Y                        
CREATETIME DATE          Y                         
 
SQL> alter table lee drop column createtime;
 
Table altered
 
SQL> desc lee
Name  Type          Nullable Default Comments
----- ------------- -------- ------- --------
ID    NUMBER                                 
NAME  VARCHAR2(100) Y                        
SCORE NUMBER        Y                        
 
SQL>
posted on 2012-12-03 10:51 abin 阅读(566) 评论(0)  编辑  收藏 所属分类: oracle

只有注册用户登录后才能发表评论。


网站导航: