Skip Headers

Oracle9i SQL Reference
Release 2 (9.2)

Part Number A96540-02
Go to Documentation Home
Home
Go to Book List
Book List
Go to Table of Contents
Contents
Go to Index
Index
Go to Master Index
Master Index
Go to Feedback page
Feedback

Go to previous page Go to next page
View PDF

ALTER TABLE

Purpose

Use the ALTER TABLE statement to alter the definition of a nonpartitioned table, a partitioned table, a table partition, or a table subpartition. For object tables or relational tables with object columns, use ALTER TABLE to convert the table to the latest definition of its referenced type after the type has been altered.

See Also:

Additional Topics:

Prerequisites

The table must be in your own schema, or you must have ALTER privilege on the table, or you must have ALTER ANY TABLE system privilege. For some operations you may also need the CREATE ANY INDEX privilege.

Additional Prerequisites for Partitioning Operations

If you are not the owner of the table, then you need the DROP ANY TABLE privilege in order to use the drop_table_partition or truncate_table_partition clause.

You must also have space quota in the tablespace in which space is to be acquired in order to use the add_table_partition, modify_table_partition, move_table_partition, and split_table_partition clauses.

Additional Prerequisites for Constraints and Triggers

To enable a unique or primary key constraint, you must have the privileges necessary to create an index on the table. You need these privileges because Oracle creates an index on the columns of the unique or primary key in the schema containing the table.

To enable or disable triggers, the triggers must be in your schema or you must have the ALTER ANY TRIGGER system privilege.

Additional Prerequisites When Using Object Types

To use an object type in a column definition when modifying a table, either that object must belong to the same schema as the table being altered, or you must have either the EXECUTE ANY TYPE system privilege or the EXECUTE schema object privilege for the object type.

See Also:

CREATE INDEX for information on the privileges needed to create indexes

Syntax

alter_table::=

Text description of statements_312.gif follows
Text description of alter_table



Note:

You must specify some clause after table. That is, none of the clauses after table are required, but you must specify at least one of them.


Groups of ALTER TABLE syntax:

After each clause you will find links additional links to its component subclauses.

alter_table_properties::=

Text description of statements_393.gif follows
Text description of alter_table_properties


(physical_attributes_clause::=, logging_clause::=, data_segment_compression::=, supplemental_lg_grp_clauses::=, allocate_extent_clause::=,deallocate_unused_clause::= , upgrade_table_clause::=, records_per_block_clause::=, parallel_clause::=, row_movement_clause::=, alter_iot_clauses::=)

physical_attributes_clause::=

Text description of statements_340.gif follows
Text description of physical_attributes_clause


(storage_clause)

logging_clause::=

Text description of statements_335.gif follows
Text description of logging_clause


data_segment_compression::=

Text description of statements_391a.gif follows
Text description of data_segment_compression


supplemental_lg_grp_clauses::=

Text description of statements_37.gif follows
Text description of supplemental_lg_grp_clauses


allocate_extent_clause::=

Text description of statements_356.gif follows
Text description of allocate_extent_clause


deallocate_unused_clause::=

Text description of statements_358.gif follows
Text description of deallocate_unused_clause


upgrade_table_clause::=

Text description of statements_36.gif follows
Text description of upgrade_table_clause


(column_properties::=, modify_LOB_storage_clause::=)

records_per_block_clause::=

Text description of statements_362.gif follows
Text description of records_per_block_clause


parallel_clause::=

Text description of statements_384a.gif follows
Text description of parallel_clause


row_movement_clause::=

Text description of statements_35.gif follows
Text description of row_movement_clause


alter_iot_clauses::=

Text description of statements_38.gif follows
Text description of alter_iot_clauses


(alter_overflow_clause::=, alter_mapping_table_clauses::=)

index_org_table_clause::=

Text description of statements_342.gif follows
Text description of index_org_table_clause


mapping_table_clause::=

Text description of statements_39.gif follows
Text description of mapping_table_clause


key_compression::=

Text description of statements_346.gif follows
Text description of key_compression


index_org_overflow_clause::=

Text description of statements_348.gif follows
Text description of index_org_overflow_clause


(segment_attributes_clause::=)

segment_attributes_clause::=

Text description of statements_344.gif follows
Text description of segment_attributes_clause


(physical_attributes_clause::=, logging_clause)

alter_overflow_clause::=

Text description of statements_364.gif follows
Text description of alter_overflow_clause


(segment_attributes_clause::=, allocate_extent_clause::=, deallocate_unused_clause::=)

add_overflow_clause::=

Text description of statements_366.gif follows
Text description of add_overflow_clause


(segment_attributes_clause::=)

alter_mapping_table_clauses::=

Text description of statements_311.gif follows
Text description of alter_mapping_table_clauses


(allocate_extent_clause::=, deallocate_unused_clause::=)

column_clauses::=

Text description of statements_316.gif follows
Text description of column_clauses


(add_column_clause::=, modify_column_clauses::=, drop_column_clause::=, rename_column_clause::=, modify_collection_retrieval::=, modify_LOB_storage_clause::=, alter_varray_col_properties::=)

add_column_clause::=

Text description of statements_318.gif follows
Text description of add_column_clause


(inline_constraint and inline_ref_constraint: constraints, column_properties::=)

modify_column_clauses::=

Text description of statements_392a.gif follows
Text description of modify_column_clauses


modify_col_properties::=

Text description of statements_374a.gif follows
Text description of modify_col_properties


(inline_constraint: constraints)

modify_col_substitutable::=

Text description of statements_389a.gif follows
Text description of modify_col_substitutable


drop_column_clause::=

Text description of statements_322.gif follows
Text description of drop_column_clause


rename_column_clause::=

Text description of statements_390.gif follows
Text description of rename_column_clause


modify_collection_retrieval::=

Text description of statements_324.gif follows
Text description of modify_collection_retrieval


constraint_clauses::=

Text description of statements_326.gif follows
Text description of constraint_clauses


(constraint_state: constraints)

drop_constraint_clause::=

Text description of statements_330.gif follows
Text description of drop_constraint_clause


column_properties::=

Text description of statements_375.gif follows
Text description of column_properties


object_type_col_properties::=

Text description of statements_376a.gif follows
Text description of object_type_col_properties


substitutable_column_clause::=

Text description of statements_336.gif follows
Text description of substitutable_column_clause


nested_table_col_properties::=

Text description of statements_338.gif follows
Text description of nested_table_col_properties


object_properties::=

Text description of statements_350.gif follows
Text description of object_properties


(inline_constraint, inline_ref_constraint, out_of_line_constraint, out_of_line_ref_constraint: constraints)

supplemental_logging_props::=

Text description of statements_352.gif follows
Text description of supplemental_logging_props


physical_properties::=

Text description of statements_354.gif follows
Text description of physical_properties


(segment_attributes_clause::=, index_org_table_clause::=, external_data_properties::=)

varray_col_properties::=

Text description of statements_360.gif follows
Text description of varray_col_properties


(substitutable_column_clause::=)

LOB_storage_clause::=

Text description of statements_34.gif follows
Text description of LOB_storage_clause


LOB_parameters::=

Text description of statements_310.gif follows
Text description of LOB_parameters


(storage_clause::=, logging_clause::=)

modify_LOB_storage_clause::=

Text description of statements_313.gif follows
Text description of modify_LOB_storage_clause


modify_LOB_parameters::=

Text description of statements_315.gif follows
Text description of modify_LOB_parameters


(storage_clause::=, logging_clause::=, allocate_extent_clause::=, deallocate_unused_clause::=)

alter_varray_col_properties::=

Text description of statements_317.gif follows
Text description of alter_varray_col_properties


LOB_partition_storage::=

Text description of statements_328.gif follows
Text description of LOB_partition_storage


(LOB_storage_clause::=, varray_col_properties::=)

XMLType_column_properties::=

Text description of statements_321.gif follows
Text description of XMLType_column_properties


XMLType_storage::=

Text description of statements_377a.gif follows
Text description of XMLType_storage


XMLSchema_spec::=

Text description of statements_385.gif follows
Text description of XMLSchema_spec


alter_external_table_clause::=

Text description of statements_325.gif follows
Text description of alter_external_table_clause


(add_column_clause::=, modify_column_clauses::=, drop_column_clause::=, drop_constraint_clause::=, parallel_clause::=)

external_data_properties::=

Text description of statements_327.gif follows
Text description of external_data_properties


alter_table_partitioning::=

Text description of statements_368.gif follows
Text description of alter_table_partitioning


(modify_table_default_attrs::=, set_subpartition_template::=, modify_table_partition::=, modify_table_subpartition::=, move_table_partition::=, move_table_subpartition::=, add_table_partition::=, coalesce_table_partition::=, drop_table_partition::=, drop_table_subpartition::=, rename_partition_subpart::=, truncate_partition_subpart::=, split_table_partition::=, split_table_subpartition::, merge_table_partitions::=, merge_table_subpartitions::=, exchange_partition_subpart::=

modify_table_default_attrs::=

Text description of statements_370.gif follows
Text description of modify_table_default_attrs


(segment_attributes_clause::=, key_compression::=, LOB_parameters::=, alter_overflow_clause::=)

set_subpartition_template::=

Text description of statements_365.gif follows
Text description of set_subpartition_template


(list_values_clause::=, partitioning_storage_clause::=)

modify_table_partition::=

Text description of statements_395.gif follows
Text description of modify_table_partition


(modify_range_partition::=, modify_hash_partition::=, modify_list_partition::=)

modify_range_partition::=

Text description of statements_339a.gif follows
Text description of modify_range_partition


(partition_attributes::=, alter_mapping_table_clauses::=)

modify_hash_partition::=

Text description of statements_341.gif follows
Text description of modify_hash_partition


(partition_attributes::=, add_hash_subpartition::=, update_global_index_clause::=, parallel_clause::=, alter_mapping_table_clauses::=)

modify_list_partition::=

Text description of statements_386a.gif follows
Text description of modify_list_partition


(partition_attributes::=, add_list_subpartition::=)

modify_table_subpartition::=

Text description of statements_376.gif follows
Text description of modify_table_subpartition


modify_hash_subpartition::=, modify_list_subpartition::=)

move_table_partition::=

Text description of statements_377.gif follows
Text description of move_table_partition


(table_partition_description::=, update_global_index_clause::=, parallel_clause::=)

move_table_subpartition::=

Text description of statements_382.gif follows
Text description of move_table_subpartition


(subpartition_spec::=, update_global_index_clause::=, parallel_clause::=)

add_table_partition::=

Text description of statements_387a.gif follows
Text description of add_table_partition


add_range_partition_clause::=

Text description of statements_369.gif follows
Text description of add_range_partition_clause


(range_values_clause::=, table_partition_description::=)

add_hash_partition_clause::=

Text description of statements_383.gif follows
Text description of add_hash_partition_clause


(partitioning_storage_clause::=, update_global_index_clause::=, parallel_clause::=)

add_list_partition_clause::=

Text description of statements_384.gif follows
Text description of add_list_partition_clause


(list_values_clause::=, table_partition_description::=)

coalesce_table_partition::=

Text description of statements_380.gif follows
Text description of coalesce_table_partition


(update_global_index_clause::=, parallel_clause::=)

drop_table_partition::=

Text description of statements_393b.gif follows
Text description of drop_table_partition


(update_global_index_clause::=, parallel_clause::=)

drop_table_subpartition::=

Text description of statements_349.gif follows
Text description of drop_table_subpartition


(update_global_index_clause::=, parallel_clause::=)

rename_partition_subpart::=

Text description of statements_386.gif follows
Text description of rename_partition_subpart


truncate_partition_subpart::=

Text description of statements_387.gif follows
Text description of truncate_partition_subpart


(update_global_index_clause::=, parallel_clause::=)

split_table_partition::=

Text description of statements_388.gif follows
Text description of split_table_partition


(partition_spec::=, update_global_index_clause::=, parallel_clause::=)

split_table_subpartition::

Text description of statements_351.gif follows
Text description of partition_spec


(subpartition_spec::=, update_global_index_clause::=, parallel_clause::=)

merge_table_partitions::=

Text description of statements_389.gif follows
Text description of merge_table_partitions


(partition_spec::=, update_global_index_clause::=, parallel_clause::=)

merge_table_subpartitions::=

Text description of statements_393a.gif follows
Text description of merge_table_subpartitions


(subpartition_spec::=, update_global_index_clause::=, parallel_clause::=)

exchange_partition_subpart::=

Text description of statements_391.gif follows
Text description of exchange_partition_subpart


(update_global_index_clause::=, parallel_clause::=)

exceptions_clause::=

Text description of statements_392.gif follows
Text description of exceptions_clause


list_values_clause::=

Text description of statements_381.gif follows
Text description of list_values_clause


range_values_clause::=

Text description of statements_394.gif follows
Text description of range_values_clause


partitioning_storage_clause::=

Text description of statements_345.gif follows
Text description of partitioning_storage_clause


partition_attributes::=

Text description of statements_373.gif follows
Text description of partition_attributes


(physical_attributes_clause::=, logging_clause::=, allocate_extent_clause::=, deallocate_unused_clause::=, data_segment_compression::=, modify_LOB_parameters::=)

add_hash_subpartition::=

Text description of statements_374.gif follows
Text description of add_hash_subpartition


(subpartition_spec::=, update_global_index_clause::=)

add_list_subpartition::=

Text description of statements_382a.gif follows
Text description of add_list_subpartition


(subpartition_spec::=)

modify_hash_subpartition::=

Text description of statements_396.gif follows
Text description of modify_hash_subpartition


(allocate_extent_clause::=, deallocate_unused_clause::=, modify_LOB_parameters::=)

modify_list_subpartition::=

Text description of statements_383a.gif follows
Text description of modify_list_subpartition


(allocate_extent_clause::=, deallocate_unused_clause::=, modify_LOB_parameters::=)

table_partition_description::=

Text description of statements_378.gif follows
Text description of table_partition_description


(segment_attributes_clause::=, key_compression::=, LOB_storage_clause::=, varray_col_properties::=)

partition_level_subpartition::=

Text description of statements_379.gif follows
Text description of partition_level_subpartition


(subpartition_spec::=)

partition_spec::=

Text description of statements_395a.gif follows
Text description of partition_spec


(table_partition_description::=)

subpartition_spec::=

Text description of statements_380a.gif follows
Text description of subpartition_spec


(list_values_clause::=, partitioning_storage_clause::=)

update_global_index_clause::=

Text description of statements_339.gif follows
Text description of update_global_index_clause


parallel_clause::=

Text description of statements_319.gif follows
Text description of parallel_clause


move_table_clause::=

Text description of statements_3a.gif follows
Text description of move_table_clause


(segment_attributes_clause::=, index_org_table_clause::=, LOB_storage_clause::=, varray_col_properties::=)

enable_disable_clause::=

Text description of statements_32.gif follows
Text description of enable_disable_clause


(using_index_clause::=, exceptions_clause::=,)

using_index_clause::=

Text description of statements_33.gif follows
Text description of using_index_clause


(create_index::=, storage_clause, logging_clause::=)

global_partitioned_index::=

Text description of statements_329.gif follows
Text description of global_partitioned_index


index_partitioning_clause::=

Text description of statements_331.gif follows
Text description of index_partitioning_clause


Semantics

Many clauses of the ALTER TABLE statement have the same functionality they have in a CREATE TABLE statement. For more information on such clauses, please see CREATE TABLE.


Note:

Operations performed by the ALTER TABLE statement can cause Oracle to invalidate procedures and stored functions that access the table. For information on how and when Oracle invalidates such objects, see Oracle9i Database Concepts.


schema

Specify the schema containing the table. If you omit schema, then Oracle assumes the table is in your own schema.

table

Specify the name of the table to be altered.

Restrictions on Temporary Tables

You can modify, drop columns from, or rename a temporary table. However, for a temporary table you cannot:

Restrictions on External Tables

You can add, drop, or modify the columns of an external table. However, for an external table you cannot:

alter_table_properties

Use the alter_table_clauses to modify a database table.

physical_attributes_clause

The physical_attributes_clause lets you change the value of PCTFREE, PCTUSED, INITRANS, and MAXTRANS parameters and storage characteristics.

Restrictions on Altering Table Physical Attributes
data_segment_compression

The data_segment_compression clause is valid only for heap-organized tables. Use this clause to instruct Oracle whether to compress data segments to reduce disk and memory use. The COMPRESS keyword enables data segment compression. The NOCOMPRESS keyword disables data segment compression.


Note:

The first time a table is altered in such a way that compressed data will be added, all bitmap indexes and bitmap index partitions on that table must be marked UNUSABLE.


See Also:
logging_clause

Specify whether subsequent Direct Loader (SQL*Loader) and direct-path INSERT operations against a nonpartitioned table, table partition, all partitions of a partitioned table, or all subpartitions of a partition will be logged (LOGGING) or not logged (NOLOGGING) in the redo log file.

When used with the modify_table_default_attrs clause, this clause affects the logging attribute of a partitioned table.

Thelogging_clause also specifies whether ALTER TABLE ... MOVE and ALTER TABLE ... SPLIT operations will be logged or not logged.

See Also:

supplemental_lg_grp_clauses

The supplemental_lg_grp_clauses let you add and drop supplemental redo log groups.

allocate_extent_clause

Use the allocate_extent_clause to explicitly allocate a new extent for the table, the partition or subpartition, the overflow data segment, the LOB data segment, or the LOB index.

Restriction on Allocating Table Extents

You cannot allocate an extent for a temporary table or for a range- or composite-partitioned table.

See Also:

allocate_extent_clause for a full description of this clause and "Allocating Extents: Example"

deallocate_unused_clause

Use the deallocate_unused_clause to explicitly deallocate unused space at the end of the table, partition or subpartition, overflow data segment, LOB data segment, or LOB index and make the space available for other segments in the tablespace.

See Also:

deallocate_unused_clause for a full description of this clause and "Deallocating Unused Space: Example"

CACHE | NOCACHE

Use the CACHE clauses to indicate how Oracle should store blocks in the buffer cache. If you specify neither CACHE nor NOCACHE:

CACHE Clause

For data that is accessed frequently, this clause indicates that the blocks retrieved for this table are placed at the most recently used end of the least recently used (LRU) list in the buffer cache when a full table scan is performed. This attribute is useful for small lookup tables.

As a parameter in the LOB_storage_clause, CACHE specifies that Oracle places LOB data values in the buffer cache for faster access.

Restriction on CACHE

You cannot specify CACHE for an index-organized table. However, index-organized tables implicitly provide CACHE behavior.

NOCACHE Clause

For data that is not accessed frequently, this clause indicates that the blocks retrieved for this table are placed at the least recently used end of the LRU list in the buffer cache when a full table scan is performed.

As a parameter in the LOB_storage_clause, NOCACHE specifies that the LOB value is either not brought into the buffer cache or brought into the buffer cache and placed at the least recently used end of the LRU list. (The latter is the default behavior.)

Restriction on NOCACHE

You cannot specify NOCACHE for index-organized tables.

MONITORING | NOMONITORING
MONITORING Clause

Specify MONITORING if you want Oracle to collect modification statistics on table. These statistics are estimates of the number of rows affected by DML statements over a particular period of time. They are available for use by the optimizer or for analysis by the user.

See Also:

Oracle9i Database Performance Tuning Guide and Reference for more information on using this clause

NOMONITORING Clause

Specify NOMONITORING if you do not want Oracle to collect modification statistics on table.

Restriction on MONITORING

You cannot specify MONITORING or NOMONITORING for a temporary table.

upgrade_table_clause

The upgrade_table_clause is relevant for object tables and for relational tables with object columns. It lets you instruct Oracle to convert the metadata of the target table to conform with the latest version of each referenced type. If table is already valid, then the table metadata remains unchanged.

Restriction on Upgrading Object Tables and Columns

Within this clause, you cannot specify object_type_col_properties as a clause of column_properties.

INCLUDING DATA

Specify INCLUDING DATA if you want Oracle to convert the data in the table to the latest type version format (if it was not converted when the type was altered). You can define the storage for any new column while upgrading the table by using the column_properties and the LOB_partition_storage. This is the default.

For information on whether a table contains data based on an older type version, refer to the DATA_UPGRADED column of the USER_TAB_COLUMNS data dictionary view.

NOT INCLUDING DATA

Specify NOT INCLUDING DATA if you want Oracle to leave column data unchanged.

Restriction on NOT INCLUDING DATA

You cannot specify NOT INCLUDING DATA if the table contains columns in Oracle8 release 8.0.x image format. To determine whether the table contains such columns, refer to the V80_FMT_IMAGE column of the USER_TAB_COLUMNS data dictionary view.

See Also:
records_per_block_clause

The records_per_block_clause lets you specify whether Oracle restricts the number of records that can be stored in a block. This clause ensures that any bitmap indexes subsequently created on the table will be as small (compressed) as possible.

Restrictions on Restricting Records in a Block
MINIMIZE

Specify MINIMIZE to instruct Oracle to calculate the largest number of records in any block in the table, and limit future inserts so that no block can contain more than that number of records.

Oracle Corporation recommends that a representative set of data already exist in the table before you specify MINIMIZE. If you are using data segment compression (see data_segment_compression), then a representative set of compressed data should already exist in the table.

Restriction on MINIMIZE

You cannot specify MINIMIZE for an empty table.

NOMINIMIZE

Specify NOMINIMIZE to disable the MINIMIZE feature. This is the default.

RENAME TO

Use the RENAME clause to rename table to new_table_name.

Restriction on Renaming a Table

You cannot rename a materialized view.


Note:

Using this clause invalidates any dependent materialized views. For more information on materialized views, see CREATE MATERIALIZED VIEW and Oracle9i Data Warehousing Guide.


row_movement_clause

The row_movement_clause lets you specify whether Oracle can move a table row. It is possible for a row to move, for example, during data segment compression or an update operation on partitioned data.


Caution:

If you need static rowids for data access, do not enable row movement. For a normal (heap-organized) table, moving a row changes that row's rowid. For a moved row in an index-organized table, the logical rowid remains valid, although the physical guess component of the logical rowid becomes inaccurate.


Restriction on Row Movement

You cannot specify this clause for a nonpartitioned index-organized table.

alter_iot_clauses

index_org_table_clause

See index_org_table_clause in the context of CREATE TABLE.

See Also:

"Modifying Index-Organized Tables: Examples"

alter_overflow_clause

The alter_overflow_clause lets you change the definition of an index-organized table. Index-organized tables keep data sorted on the primary key and are therefore best suited for primary-key-based access and manipulation.


Note:

When you add a column to an index-organized table, Oracle evaluates the maximum size of each column to estimate the largest possible row. If an overflow segment is needed but you have not specified OVERFLOW, then Oracle raises an error and does not execute the ALTER TABLE statement. This checking function guarantees that subsequent DML operations on the index-organized table will not fail because an overflow segment is lacking.


PCTTHRESHOLD integer

Specify the percentage of space reserved in the index block for an index-organized table row. PCTTHRESHOLD must be large enough to hold the primary key. All trailing columns of a row, starting with the column that causes the specified threshold to be exceeded, are stored in the overflow segment. PCTTHRESHOLD must be a value from 1 to 50. If you do not specify PCTTHRESHOLD, the default is 50.

Restriction on PCTTHRESHOLD

You cannot specify PCTTHRESHOLD for individual partitions of an index-organized table.

INCLUDING column_name

Specify a column at which to divide an index-organized table row into index and overflow portions. The primary key columns are always stored in the index. column_name can be either the last primary-key column or any non-primary-key column. All non-primary-key columns that follow column_name are stored in the overflow data segment.

Restriction on the INCLUDING Clause

You cannot specify this clause for individual partitions of an index-organized table.


Note:

If an attempt to divide a row at column_name causes the size of the index portion of the row to exceed the PCTTHRESHOLD value (either specified or default), Oracle breaks up the row based on the PCTTHRESHOLD value.


overflow_attributes

The overflow_attributes let you specify the overflow data segment physical storage and logging attributes to be modified for the index-organized table. Parameters specified in this clause are applicable only to the overflow data segment.

See Also:

CREATE TABLE

add_overflow_clause

The add_overflow_clause lets you add an overflow data segment to the specified index-organized table. You can also use this clause to explicitly allocate an extent to or deallocate unused space from an existing overflow segment.

Use the STORE IN tablespace clause to specify tablespace storage for the entire overflow segment. Use the PARTITION clause to specify tablespace storage for the segment by partition.

For a partitioned index-organized table:

You can find the order of the partitions by querying the PARTITION_NAME and PARTITION_POSITION columns of the USER_IND_PARTITIONS view.

If you do not specify TABLESPACE for a particular partition, then Oracle uses the tablespace specified for the table. If you do not specify TABLESPACE at the table level, then Oracle uses the tablespace of the partition's primary key index segment.

See Also:

allocate_extent_clause and deallocate_unused_clause for full descriptions of these clauses of the add_overflow_clause

alter_mapping_table_clauses

The alter_mapping_table_clauses is valid only if table is index organized and has a mapping table.

UPDATE BLOCK REFERENCES

Specify UPDATE BLOCK REFERENCES to update all stale "guess" data block addresses stored as part of the logical ROWID column in the mapping table with the correct address for the corresponding block identified by the primary key.

allocate_extent_clause

Use the allocate_extent_clause to allocate a new extent at the end of the mapping table for the index-organized table.

See Also:

allocate_extent_clause for a full description of this clause

deallocate_unused_clause

Specify the deallocate_unused_clause to deallocate unused space at the end of the mapping table of the index-organized table.

See Also:

deallocate_unused_clause for a full description of this clause

COALESCE

The keyword is relevant only if table is index organized. Specify COALESCE to instruct Oracle to combine the primary key index blocks of the index-organized table where possible to free blocks for reuse. You can specify this clause with the parallel_clause.

column_clauses

add_column_clause

The add_column_clause lets you add a column to a table.

See Also:

CREATE TABLE for a description of the keywords and parameters of this clause and "Adding a Table Column: Example"

If you add a column, then the initial value of each row for the new column is null unless you specify the DEFAULT clause. In this case, Oracle updates each row in the new column with the value you specify for DEFAULT. This update operation, in turn, fires any AFTER UPDATE 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 value completely. That is, if a column has ever had a default value assigned to it, then the DATA_DEFAULT column of the USER_TAB_COLUMNS data dictionary view will always display either a default value or NULL.


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

You can add LOB columns to nonpartitioned and partitioned tables. You can specify LOB storage at the table and at the partition or subpartition level.

If you previously created a view with a query that used the "SELECT *" syntax to select all columns from table, and you now add a column to table, then Oracle does not automatically add the new column to the view. To add the new column to the view, re-create the view using the CREATE VIEW statement with the OR REPLACE clause.

See Also:

CREATE VIEW

Restrictions on Adding Columns
DEFAULT

Use the DEFAULT clause to specify a default for a new column or a new default for an existing column. Oracle assigns this value to the column if a subsequent INSERT statement omits a value for the column. If you are adding a new column to the table and specify the default value, then Oracle inserts the default column value into all rows of the table.

The datatype of the default value must match the datatype specified for the column. The column must also be long enough to hold the default value.

Restrictions on Default Column Values
inline_constraint

Use inline_constraint to add a constraint to the new column

inline_ref_constraint

This clause lets you describe a new column of type REF.

See Also:

constraints for syntax and description of this type of constraint, including restrictions

column_properties

The column_properties determine the storage characteristics of an object, nested table, varray, or LOB column.

object_type_col_properties

This clause is valid only when you are adding a new object type column or attribute. To modify the properties of an existing object type column, use the modify_column_clauses.

Use the object_type_col_properties to specify storage characteristics for a new object column or attribute or an element of a collection column or attribute.

column

For column, specify an object column or attribute.

substitutable_column_clause

The substitutable_column_clause indicates whether object columns or attributes in the same hierarchy are substitutable for each other. You can specify that a column is of a particular type, or whether it can contain instances of its subtypes, or both.

Restrictions on the substitutable_column_clause
nested_table_col_properties

The nested_table_col_properties clause lets you specify separate storage characteristics for a nested table, which in turn lets you to define the nested table as an index-organized table. You must include this clause when creating a table with columns or column attributes whose type is a nested table. (Clauses within this clause that function the same way they function for parent object tables are not repeated here.)