Oracle's column operations (adding columns, modifying columns, deleting columns), including operating multiple columns

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;

 

  There are several points to pay attention to here. First, adding and modifying columns does not need to add the keyword COLUMN, otherwise an error ora-00905 will be reported.

  Secondly, if you delete a single column, you must add COLUMN, and then remember that you do not need to add a column type to delete.

 

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);

Very strange phenomenon, the keyword COLUMN should be added to a single column, but when multiple columns are deleted, the COLUMN keyword cannot be added.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326367479&siteId=291194637