SQL Server Information and Resources Bookmark this page

SQLINFO.net is a Community Service from DataExpressions makers of dbOrchestra©

Google
 

 

 

 


Oracle Code Examples

SQL DML

String Functions

Stored Procedures

SQL Views

SQL Table Basics


Oracle - SQL Table Basics - Altering/Adding Columns

Adding column

You can add new columns to an existing table. .

ALTER TABLE PHONE
      MODIFY ( INACTIVE_DATE DATE ) 
/

Alter column

You can add modify an existing column

ALTER TABLE PERSON
MODIFY ( LASTNAME VARCHAR2(35) ) 
/

Considerations for altering a column

  • Reducing precision (example, going from CHAR(20) to CHAR(15)) can cause data truncation and should be avoided unless you are absolutely sure their will be no impact to the data.
  • Changing data types should typically be avoided. There are exceptions to this. For example, changing a CHAR(20) to a VARCHAR(20) on columns where the average storage length is 10 can save disk space.

Alter columns - No Can Do

  • You cannot directly alter a a column that is part of the primary key

 

 



Copyright 2006-2007 by DataExpressions --- All Rights Reserved            dbOrchestra - Oracle home page