Oracle modifies the original field type

Source: Internet
Author: User

If:

Make changes to the table field type.

For example, the table name is a, the field is A_name

field compatibility can be modified directly! In this case of incompatibility, there will be an error message:ORA-01439: To change the data type, the column to be modified must be empty

1 My scene is to convert the Varchar2 to CLOB, the following is the implementation process2 3  //rename A_name to A_name14 ALTER TABLEA RENAMECOLUMNA_nameto a_name1;5 6 //Add new Field A_name7 ALTER TABLEAADDa_name CLOB;8 9 //Transfer of ValuesTen UPDATEASETERROR=TRIM (a_name1); One  A //Delete the original field, the data has been transferred to the specified field. - ALTER TABLEADROP COLUMNa_name1;

1 the usage of the General Action Field also has the following points:2 3 --Add New Field4 ALTER TABLEAADDcolumn_name Number;5 6 --Modify Field Length7 ALTER TABLEA MODIFY column_name Number(Ten); 8  9 --Modify Field namesTen ALTER TABLEA RENAMECOLUMNcolumn_name tocolmn_name_new; One  A --Delete the specified field - ALTER TABLEADROP COLUMNcolumn_name

These are the basic uses of the field of the action table.

Oracle modifies the original field type

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.