Oracle base - modified column data types on which data

 

My personal steps to modify column names, may be too careful  

table_name table name

To modify the column column_name column names

Newcolumn_name column name change

CAST (AS type data to be converted) converts the data type to another type from the original type   

1. confirm the changes listed in the table is present

select column_name from Table_name;

2. Check the column data type table

select * USER_TAB_COLUMNS where TABLE_NAME = 'TABLE_NMAE'; at this time indicate = name must be all uppercase;

3. Modify to modify the value column name

alter table  Table_name rename column column_name to   newcolumn_name;

4. Add a new column, column entitled to modify the original column name of the column

alter table Table_name add comlumn_name varchar2(10);

5. The backup of the original column data to the new column

update table_name set column_name = CAST (newcolumn_name AS varchar (10)); // back to convert the type AS

 

Guess you like

Origin www.cnblogs.com/egao/p/12364920.html