Oracle Column Operations (adding columns, modifying columns, and deleting columns), including operations on multiple columns

Source: Internet
Author: User

Add a column:

Alter table emp4 add Test varchar2 (10 );

Modify a column:

Alter table emp4 modify test varchar2 (20 );

Delete a column:

Alter table emp4 drop column test;

 

Here pay attention to a few places, first, add and modify the column is not need to add the keyword column, otherwise it will report an error ora-00905.

Second, if you delete a single column, you must add column. Remember that you do not need to add the column type to delete the column.

 

Add multiple columns:

Alter table emp4 add (test varchar2 (10), Test2 number );

Modify multiple columns:

Alter table emp4 modify (test varchar2 (20), Test2 varchar2 (20 ));

Delete multiple columns:

Alter table emp4 drop (test, Test2 );

It is strange that the keyword column must be added to a single column. However, when you delete multiple columns, the column keyword cannot be added.

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.