Sei sulla pagina 1di 3

25/09/13

Oracle "alter table" modify column Syntax example

Search BC Oracle Sites

Oracle Tips

Oracle alter table modify column Syntax example


Search Home E-mail Us Oracle Articles
Oracle Tips by Burleson Consulting

Got Q uestions? Free AWR Report Analysis Restart a Failed Daemon Process BEWARE of 11gR2 Upgrade Gotchas! Oracle 12c has been released

Oracle Training Oracle Tips Oracle Forum Class Catalog

For complete tips on Oracle alter table syntax, see the book "Easy Oracle Jumpstart". Oracle provides "alter table" syntax to modify data columns in-place in this form:
a l t e rt a b l e t a b l e _ n a m e m o d i f y c o l u m n _ n a m e d a t a t y p e ;

If you are brave you can use a single "alter table" syntax to modify multiple columns:
Remote DBA Oracle Tuning Emergency 911 RAC Support Apps Support Analysis Design Implementation Oracle Support
a l t e rt a b l e t a b l e _ n a m e m o d i f y ( c o l u m n 1 _ n a m e c o l u m n 2 _ n a m e c o l u m n 3 _ n a m e c o l u m n 4 _ n a m e ) ;

c o l u m n 1 _ d a t a t y p e , c o l u m n 2 _ d a t a t y p e , c o l u m n 3 _ d a t a t y p e , c o l u m n 4 _ d a t a t y p e

Here are some examples of Oracle "alter table" syntax to modify data columns and note that you can add constraints like NOT NULL:
A L T E RT A B L E c u s t o m e r M O D I F Y ( c u s t _ n a m ev a r c h a r 2 ( 1 0 0 )n o tn u l l , c u s t _ h a i r _ c o l o r v a r c h a r 2 ( 2 0 ) ) ;

SQL Tuning Security Oracle UNIX Oracle Linux Monitoring Remote support Remote plans Remote services Application Server Applications Oracle Forms Oracle Portal App Upgrades SQL Server Oracle Concepts Softw are Support Remote Support Development Implementation

We can also use Oracle "alter table" syntax in dynamic PL/SQL to modify data columns
B E G I N S Q L _ S T R I N G: =' A L T E RT A B L E' | | : T A B L E _ N A M E | | 'M O D I F Y' | | : C O L U M N _ N A M E | | 'V A R C H A R 2 ( 1 0 0 ) ' ; ... E N D ;

Consulting Staff Consulting Prices Help Wanted!

www.dba-oracle.com/t_alter_table_modify_column_syntax_example.htm

1/3

25/09/13

Oracle "alter table" modify column Syntax example

Oracle Posters Oracle Books Oracle Scripts Ion Excel-DB

Burleson is the American Team

Note: This Oracle documentation was created as a support and Oracle training reference for use by our DBA performance tuning consulting professionals. Feel free to ask questions on our Oracle forum. Verify experience! Anyone considering using the services of an Oracle support

www.dba-oracle.com/t_alter_table_modify_column_syntax_example.htm

2/3

25/09/13

Oracle "alter table" modify column Syntax example


expert should independently investigate their credentials and experience, and not rely on advertisements and self-proclaimed expertise. All legitimate Oracle experts publish their Oracle qualifications. Errata? Oracle technology is changing and we strive to update our BC Oracle support information. If you find an error or have a suggestion for improving our content, we would appreciate your feedback. Just e-mail: and include the URL for the page.

Burleson Consulting
The Oracle of Database Support Oracle Performance Tuning

Remote DBA Services

Copyright 1996 - 2012 All rights re se rve d. O racle is the re giste re d trade mark of O racle Corporation.

www.dba-oracle.com/t_alter_table_modify_column_syntax_example.htm

3/3

Potrebbero piacerti anche