oracle更改欄位名順序的方法

paulyibinyi發表於2007-12-17

要是不停應用也可以採用在先重定義的方法
這裡講的是可以停應用的方法:

1.停應用

原有表結構順序為
desc test
id number
b numer
a number
需要調整為
desc test
id number
a number
b number
2.備份需要調整表的順序資料
create table test_bk as select * from test;

3.刪除表
drop table test;

4.建立表為調整後的正確順序
create table test
(id number,
a number,
b number)
包括主鍵,索引,約束,觸發器等

5.禁用觸發器

6.插回資料
insert into test select id,a,b from test_bk;

7.啟用觸發器
更改完成

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/7199859/viewspace-722/,如需轉載,請註明出處,否則將追究法律責任。

相關文章