ALTER TABLE

Change the properties of an existing table.

Syntax:

   ALTER TABLE [schema.]table
      RENAME TO new_table_name

   ALTER TABLE [schema.]table
      [ [NO]MINIMISE RECORDS PER BLOCK ]
          [PARALLEL parallel_clause]
             [ENABLE enable_clause | DISABLE disable_clause]
                 [{ENABLE|DISABLE} TABLE LOCK]
                    [{ENABLE|DISABLE} ALL TRIGGERS]

   ALTER TABLE [schema.]table
      iot_overflow_clause
          [PARALLEL parallel_clause]
             [ENABLE enable_clause | DISABLE disable_clause]
                 [{ENABLE|DISABLE} TABLE LOCK]
                    [{ENABLE|DISABLE} ALL TRIGGERS]

   ALTER TABLE [schema.]table
      partitioning_clause
          [PARALLEL parallel_clause]
             [ENABLE enable_clause | DISABLE disable_clause]
                 [{ENABLE|DISABLE} TABLE LOCK]
                    [{ENABLE|DISABLE} ALL TRIGGERS]

   ALTER TABLE [schema.]table
      tbl_defs,...
          [PARALLEL parallel_clause]
             [ENABLE enable_clause | DISABLE disable_clause]
                 [{ENABLE|DISABLE} TABLE LOCK]
                    [{ENABLE|DISABLE} ALL TRIGGERS]

tbl_defs:
   ADD [column datatype] [DEFAULT expr] [column_constraint(s)]
     [table_constraint] [table_ref_constraint]

   MODIFY [column datatype] [DEFAULT expr] [column_constraint(s)]

   MODIFY [table_constraint]

   drop_column_clause

   DROP drop_constraint_clause

   [PCTFREE int][PCTUSED int][INITTRANS int]
      [MAXTRANS int][STORAGE storage_clause]

   extent_options

   MOVE [ONLINE] storage_options INDEX index_organized_tbl_clause
      [LOB_storage_clause][varray_clause]

   LOGGING|NOLOGGING

   MODIFY NESTED TABLE collection_item RETURN AS {LOCATOR|VALUE}

   MODIFY LOB [LOB_storage_clause]

   MODIFY VARRAY [varray_clause]

   CACHE | NOCACHE

   MONITORING | NOMONITORING

storage_options:
   PCTFREE int
   PCTUSED int
   INITTRANS int
   MAXTRANS int
   STORAGE storage_clause
   TABLESPACE tablespace
   [LOGGING|NOLOGGING]

extent_options:
   ALLOCATE EXTENT [( [size int K | M ]
      [DATAFILE 'filename' ] [INSTANCE int] )]
   DEALLOCATE UNUSED [KEEP int K | M ]

index_organized_tbl_clause:
   storage_option(s) [PCTTHRESHOLD int]
     [COMPRESS int|NOCOMPRESS]
         [ [INCLUDING column_name] OVERFLOW [storage_option(s)] ]

iot_overflow_clause:
   {PCTTHRESHOLD int | INCLUDING column} |
       OVERFLOW overflow_storage_clause
          ADD OVERFLOW [storage_options] [(PARTITION storage_options)]

overflow_storage_clause:
   PCTFREE int
   PCTUSED int
   INITTRANS int
   MAXTRANS int
   extent_options
   STORAGE storage_clause
   [LOGGING|NOLOGGING]

nested_storage_clause:
   NESTED TABLE nested_item STORE AS storage_table
      [RETURN AS {LOCATOR|VALUE} ]

drop_column_clause:
   SET UNUSED (column,...)
      [CASCADE CONSTRAINTS][INVALIDATE]

   DROP COLUMN (column,...)
      [CASCADE CONSTRAINTS][INVALIDATE] CHECKPOINT int

   DROP {UNUSED COLUMNS|COLUMNS CONTINUE} [CHECKPOINT int]

Example

   ALTER TABLE T_STAFF_OPTIONS
      ADD (SO_STAFF_ID INT, SO_PENSION_ID INT)
          STORAGE INITIAL 10 K
          NEXT 10 K
          MAXEXTENTS 121
          PCTINCREASE 0
          FREELISTS 2
      DROP CONSTRAINT cons_SO;

"He who knows that enough is enough will always have enough." - Lao Tsu

Related Commands:

ANALYZE TABLE COMPUTE STATISTICS
ALTER INDEX
ALTER VIEW
RENAME
DBMS_REDEFINITION

Related Views:

  DBA_ALL_TABLES       ALL_ALL_TABLES       USER_ALL_TABLES
  DBA_TABLES           ALL_TABLES           USER_TABLES         TAB
                                                                DICTIONARY
                                                                DICT_COLUMNS



Back to the Top

Simon Sheppard
SS64.com