修改表增加欄位預設值default

來源:互聯網
上載者:User

對個生產庫的表增加1個欄位.欄位類型是INT型, 表資料有2千萬條, alter table table_name add xxoo number(4) default  0 ;

因此 不僅要修改字典,還要重新整理全部資料.

1) 在ALTER sql中有帶預設值,ORACLE會直接重新整理全部的記錄。
2) 在ALTER sql中沒有帶預設值,ORACLE只會影響到後來的記錄。

 
Executed in 0.062 seconds

 alter table table_name add xxoo number(4) default 0;
 
Table altered

  where b.lock_id1=33784 and a.SID=b.session_id
   and a.SQL_ADDRESS=c.ADDRESS;


相關文章

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.