Oracle中修改表中欄位名

2021-04-01 05:41:16 字數 539 閱讀 8536

更改欄位名:

--modify 不能用於更改欄位名

--alter table **_emp modify address **_address;err!

解決方法:

create table ut as select name,tel,id empid from **_emp;--將**_emp中資料取出並存到新建的表ut中,並將字段id改名為empid

drop table **_emp;

rename ut to **_emp;

刪除欄位名:

alter table 表名 drop column 列名;-----8i中新增

alter table **_emp drop column address;

8i以前版本的解決方法:

create table ut as select name,tel from **_emp;--將**_emp中資料取出並存到新建的表ut中,並將字段id去掉

drop table **_emp;

rename ut to **_emp;

oracle 修改 欄位名稱

暫時應該沒有對應的方法,所以我用自己想好的方法去修改 修改原欄位名 name 為name tmp,是將想改名稱的字段改為沒用 臨時的字段 alter table 表名 rename column 老欄位 to 新字段 增加乙個和原欄位名同名的字段 name alter table 表名 add 老欄...

Oracle修改表結構欄位名和字段長度

新增欄位的語法 alter table tablename add column datatype default value null not null 修改欄位的語法 alter table tablename modify column datatype default value null ...

取Oracle 表名 欄位名

檢視oracle 資料庫中本使用者下的所有表 select table name from user tables 檢視oracle 資料庫中所有使用者下的所有表 select user,table name from all tables 檢視oracle 資料庫中本使用者下的所有列 select...