如何重命名Oracle 10g中的表列

我想知道:如何重命名Oracle 10g中的表列?

SQL> create table a(id number); Table created. SQL> alter table a rename column id to new_id; Table altered. SQL> desc a Name Null? Type ----------------------------------------- -------- ----------- NEW_ID NUMBER 

查询的语法如下所示:

 Alter table <table name> rename column <column name> to <new column name>; 

例:

 Alter table employee rename column eName to empName; 

要将不带空格的列名重命名为具有空格的列名:

 Alter table employee rename column empName to "Emp Name"; 

要将具有空格的列重命名为无空格的列名称:

 Alter table employee rename column "emp name" to empName; 
 alter table table_name rename column oldColumn to newColumn; 

假设supply_master是一个表,并且

 SQL>desc supply_master; SQL>Name SUPPLIER_NO SUPPLIER_NAME ADDRESS1 ADDRESS2 CITY STATE PINCODE SQL>alter table Supply_master rename column ADDRESS1 TO ADDR; Table altered SQL> desc Supply_master; Name ----------------------- SUPPLIER_NO SUPPLIER_NAME ADDR ///////////this has been renamed........////////////// ADDRESS2 CITY STATE PINCODE 

alter table table_name rename column old_column_name / field_name to new_column_name / field_name;

例如:将表格学生列名改为用户名;