調整Oracle資料庫中表欄位的順序

來源:互聯網
上載者:User

第一步,從資料字典視圖查詢出表的id

select object_id from all_objects where owner='SUNYARD' and object_name='TBL_WDC_INF';

第二步,通過id查出該表中所有欄位的順序

select obj#,col#,name from sys.col$ where obj#=89677;

第三步,更新欄位的順序

update sys.col$ set col#=0 where obj#=89677 and name='SN';
update sys.col$ set col#=7 where obj#=89677 and name='ANSWERCODE';
update sys.col$ set col#=9 where obj#=89677 and name='STATUS';
update sys.col$ set col#=4 where obj#=89677 and name='TOACCNO';
update sys.col$ set col#=3 where obj#=89677 and name='ACCNO';


update sys.col$ set col#=8 where obj#=89677 and name='CHECKCODE';
update sys.col$ set col#=5 where obj#=89677 and name='AMOUNT';
update sys.col$ set col#=2 where obj#=89677 and name='MERCHANTID';

update sys.col$ set col#=1 where obj#=89677 and name='SN';

注意:上述更新需要DBA許可權

相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.