modifying data types for Oracle with data columns
Method One:
Create the same temporary table
CREATE TABLE T_business_model_temp as SELECT * from T_business_model where 1=2;
//change data type to temporary table
ALTER TABLE T_business_model_temp modify Model_money number (10,2);
To assign the original table data to the most recent table
INSERT INTO T_business_model_temp select * from T_business_model;
Delete the original table
drop table T_business_model;
Renaming a staging table to the original table
ALTER TABLE t_business_model_temp Rename to T_business_model;
Add constraints for the original table (primary key, foreign key, index)
ALTER TABLE T_business_model
Add constraint Pk_t_business_model primary key (ID);
Method Two:
--Field Rename
ALTER TABLE PROJECT Rename column NAME to NAME1;
-----Change the field name to its original name
ALTER TABLE PROJECT Add NAME VARCHAR2 (300);
---assignment
Update PROJECT NP
Set np.name=np.name1;
Commit
---Remove the previously renamed field
ALTER TABLE PROJECT drop column NAME1;
Personally think the method is two better!
Data types for Oracle database-to-database fields