Home > Database, Oracle > Oracle alter table change column datatype

Oracle alter table change column datatype

February 17th, 2009

Let’s say you had a field CITIZEN in table called EMPLOYEE that was created as VARCHAR2(10) but this has to be changed to VARCHAR2(3). The syntax to change the the column datatype in Oracle is as follows:

ALTER TABLE table_name MODIFY ( column_name VARCHAR2(3));

If there is existing column data you should first export that data and then import it after the datatype change. Make sure the exported data will be suitable for import upon the change (You can’t import a row with CITIZEN column of 5 after you have changed the column to VARCHAR2(3)).

Categories: Database, Oracle Tags: , ,
Comments are closed.