Add Column Example The following statement adds a column named thriftplan of datatype NUMBER with a maximum of seven digits and two decimal places and a column named loancode of datatype CHAR with a size of one and a NOT NULL integrity constraint: ALTER TABLE emp ADD (thriftplan NUMBER(7,2), loancode CHAR(1) NOT NULL); Modify Column Examples The following statement increases the size of the thriftplan column to nine digits: ALTER TABLE emp MODIFY (thriftplan NUMBER(9,2)); Because the MODIFY clause contains only one column definition, the parentheses around the definition are optional. The following statement changes the values of the PCTFREE and PCTUSED parameters for the emp table to 30 and 60, respectively: ALTER TABLE emp PCTFREE 30 PCTUSED 60;
9i以上的版本可以使用 alter table table_name RENAME COLUMN column_name to NEW_COLUMN_NAME;
也许只能先Add Column cardid ,然后update这个cardid等于 number。最后在drop comumn number
创建一个与这个表结果相同的表然后把数据导入到这个表里,删除cardinfo创建一个新的cardinfo,再把数据导回来
The following statement adds a column named thriftplan of datatype NUMBER with a maximum of seven digits and two decimal places and a column named loancode of datatype CHAR with a size of one and a NOT NULL integrity constraint: ALTER TABLE emp
ADD (thriftplan NUMBER(7,2),
loancode CHAR(1) NOT NULL); Modify Column Examples
The following statement increases the size of the thriftplan column to nine digits: ALTER TABLE emp
MODIFY (thriftplan NUMBER(9,2));
Because the MODIFY clause contains only one column definition, the parentheses around the definition are optional. The following statement changes the values of the PCTFREE and PCTUSED parameters for the emp table to 30 and 60, respectively: ALTER TABLE emp
PCTFREE 30
PCTUSED 60;
alter table table_name RENAME COLUMN column_name to NEW_COLUMN_NAME;
说的太正确了
顶
我也帮着顶一下!
还有在Oracle客户端中对表的操作会自动生成SQL语句,你可以参照!