alter table语法

文档地址:http://docs.oracle.com/cd/B19306_01/server.102/b14200/statements_3001.htm#CIHCFDDJ

 

ALTER TABLE

Purpose

Use the ALTER TABLE statement to alterthe definition of a nonpartitioned table, a partitioned table, atable partition, or a table subpartition. For object tables orrelational tables with object columns, use ALTERTABLE to convert the table to the latest definition ofits referenced type after the type has been altered.

 

 

add_column_clause::=

Description of add_column_clause.gif follows
Description of the illustrationadd_column_clause.gif

(column_definition::=,column_properties::=)

column_definition::=

Description of column_definition.gif follows

column_definition

Unless otherwise noted in this section, the elements ofcolumn_definition have the samebehavior when adding a column to an existing table as they do whencreating a new table. Please refer to column_definition for information.

Restriction on column_definition TheSORT parameter is valid only when creating a newtable. You cannot specify SORT in thecolumn_definition of an ALTER TABLE ...ADD statement.

If you add a column, then the initial value of each row for thenew column is null unless you specify the DEFAULTclause. In this case, Oracle Database updates each row in the newcolumn with the value you specify for DEFAULT. Thisupdate operation, in turn, fires any AFTERUPDATE triggers defined on the table.

Note:

If a column has a default value, then you can use the DEFAULT clause to change the default to NULL, but you cannot remove the default valuecompletely. That is, if a column has ever had a default valueassigned to it, then the DATA_DEFAULT column of the USER_TAB_COLUMNS data dictionary view will alwaysdisplay either a default value or NULL.

You can add an overflow data segment to each partition of apartitioned index-organized table.

You can add LOB columns to nonpartitioned and partitionedtables. You can specify LOB storage at the table and at thepartition or subpartition level.

If you previously created a view with a query that used theSELECT * syntax to select all columnsfrom table, and you now add a column to table, then the database doesnot automatically add the new column to the view. To add the newcolumn to the view, re-create the view using theCREATE VIEW statement with theOR REPLACE clause. Please refer toCREATE VIEW for more information.

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值