Syntax for alter columns in a existing table in Oracle

Syntax for add, drop, rename column in the Oracle table

Add column in the existing table

alter table scott.emp add( empname varchar2(20));
alter table scott.emp add( empid number, deptid number);

Drop column in the existing table

alter table scott.emp drop (empname);
alter table scott.emp drop (empid, deptid);

Rename the column in the table

alter table scott.emp rename column empname to empname_new;

Set column unused in the table

alter table scott.emp set unused (empname);

Drop unused columns from a table

alter table scott.emp drop unused columns;

Leave a Reply