Data types for Oracle database-to-database fields

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.